Question: I ' m getting these 8 errors and I ' m not sure how to fix them: I ' m trying to create Create 1

I'm getting these 8 errors and I'm not sure how to fix them:
I'm trying to create Create 100 random Shapes and add them to the vector but Ican't with these errors.
Error C2661 'Line::Line': no overloaded function takes 2 arguments
Error C2661 'Rectangle::Rectangle': no overloaded function takes 3 arguments
Error C2661 'Triangle::Triangle': no overloaded function takes 3 arguments
Error C2661 'Circle::Circle': no overloaded function takes 2 arguments
Error C2661 'Line::Line': no overloaded function takes 2 arguments
Error C2661 'Rectangle::Rectangle': no overloaded function takes 3 arguments
Error C2661 'Triangle::Triangle': no overloaded function takes 3 arguments
Error C2661 'Circle::Circle': no overloaded function takes 2 arguments
class ShapeFactory {
public:
static Point2D RandomPoint(){
// Generate random x and y coordinates for the point
int x = rand()%100;
int y = rand()%100;
return Point2D(x, y);
}
static ConsoleColor RandomColor(){
// Generate a random color
int color = rand()%16;
return static_cast(color);
}
static std::unique_ptr RandomShape(){
// Generate a random number and create the corresponding shape
int shapeType = rand()%4;
switch (shapeType){
case 0:
return RandomLine();
case 1:
return RandomRectangle();
case 2:
return RandomTriangle();
case 3:
return RandomCircle();
default:
return nullptr;
}
}
static std::unique_ptr RandomLine(){
// Create a random line
Point2D start = RandomPoint();
Point2D end = RandomPoint();
return std::make_unique(start, end);
}
static std::unique_ptr RandomRectangle(){
// Create a random rectangle
Point2D topLeft = RandomPoint();
Point2D bottomRight = RandomPoint();
return std::make_unique(topLeft, bottomRight);
}
static std::unique_ptr RandomTriangle(){
// Create a random triangle
Point2D point1= RandomPoint();
Point2D point2= RandomPoint();
Point2D point3= RandomPoint();
return std::make_unique(point1, point2, point3);
}
static std::unique_ptr RandomCircle(){
// Create a random circle
Point2D center = RandomPoint();
int radius = rand()%50;
return std::make_unique(center, radius);
}
};
#include
#include
#include "ShapeFactory.h"
int main(){
int shapeType = rand()%16;
switch (shapeType){
case 6: {
std::vector> shapes;
for (int i =0; i <100; ++i){
shapes.push_back(ShapeFactory::RandomShape());
}
for (const auto& shape : shapes){
shape->draw();
}
break;
};
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!