Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I ' m getting these 8 errors and I ' m not sure how to fix them: I ' m trying to create Create 1
Im getting these errors and Im not sure how to fix them:
Im trying to create Create random Shapes and add them to the vector but Ican't with these errors.
Error C 'Line::Line': no overloaded function takes arguments
Error C 'Rectangle::Rectangle': no overloaded function takes arguments
Error C 'Triangle::Triangle': no overloaded function takes arguments
Error C 'Circle::Circle': no overloaded function takes arguments
Error C 'Line::Line': no overloaded function takes arguments
Error C 'Rectangle::Rectangle': no overloaded function takes arguments
Error C 'Triangle::Triangle': no overloaded function takes arguments
Error C 'Circle::Circle': no overloaded function takes arguments
class ShapeFactory
public:
static PointD RandomPoint
Generate random x and y coordinates for the point
int x rand;
int y rand;
return PointDx y;
static ConsoleColor RandomColor
Generate a random color
int color rand;
return staticcastcolor;
static std::uniqueptr RandomShape
Generate a random number and create the corresponding shape
int shapeType rand;
switch shapeType
case :
return RandomLine;
case :
return RandomRectangle;
case :
return RandomTriangle;
case :
return RandomCircle;
default:
return nullptr;
static std::uniqueptr RandomLine
Create a random line
PointD start RandomPoint;
PointD end RandomPoint;
return std::makeuniquestart end;
static std::uniqueptr RandomRectangle
Create a random rectangle
PointD topLeft RandomPoint;
PointD bottomRight RandomPoint;
return std::makeuniquetopLeft bottomRight;
static std::uniqueptr RandomTriangle
Create a random triangle
PointD point RandomPoint;
PointD point RandomPoint;
PointD point RandomPoint;
return std::makeuniquepoint point point;
static std::uniqueptr RandomCircle
Create a random circle
PointD center RandomPoint;
int radius rand;
return std::makeuniquecenter radius;
;
#include
#include
#include "ShapeFactory.h
int main
int shapeType rand;
switch shapeType
case :
std::vector shapes;
for int i ; i ; i
shapes.pushbackShapeFactory::RandomShape;
for const auto& shape : shapes
shapedraw;
break;
;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started