use objects in class

Hello i have one class created by me: Point. I want to create another class triangle and want to use point objects for vertexes of triangle, so I want to create in class triangle 3 points.
1
2
3
4
5
6
7
class Triangle
{
	Point v1 = Point();
	Point v2 = Point();
	Point v3 = Point();

};


this is my code but compiler says: only static const integral data members can be initialized within a class.
Why they should be static const? I want to change them with constructors and so on how to do that? I don't want them to be const.
It will automatically run the constructor. Just use
1
2
3
4
5
6
7
class Triangle
{
	Point v1;
	Point v2;
	Point v3;

};

and you'll be fine.
1
2
3
class Triangle{
    Point v1, v2, v3;
};
The points will be created when the class will be created.
thx :)
Topic archived. No new replies allowed.