Code:
#include <iostream>
#include <string>
using namespace std;
class Point
{
private:
int _x,_y;
public:
Point(int x,int y)
{
_x=x;
_y=y;
}
};
class Shape
{
private:
char *colour;
Point _pos;
public:
Shape(char *p,int x,int y)
{
*colour=*p;
_pos = Point(x,y);
}
};
int main()
{
Shape shape1("blue",10,20);
}
Hi guys, I'm a newbie.. In the above code, I have two classes. Point and Shape. I wanted to initialize using this "Shape shape1("blue",10,20); ". But I'm not able to do so. The compiler shows this error. error C2512: 'Point' : no appropriate default constructor available
Can someone explain to me why? Thank you!