Class Point
{
float x,y,z;
Point(float x=0.0f, y=0.0f, z=0.0f)
{
this->x=x;
this->y=y;
this->z=z;
}
};
That is, default parameters x=0, y=0, z=0. But how can I add default parameter of constructor as object? In this case:
1 2 3 4 5 6 7 8 9 10 11 12 13
Point p1(0,0,0), p2(1,0,0), p3(0,1,0);
Class Triangle
{
Point A, B, C;
Triangle(Point a=p1, Point b=p2, Point c=p3)
{
this->A=a;
this->B=b;
this->C=c;
}
};