You can't call a class. You can create instances of a class and call its member functions.
Since you have not specified which constructor to be used to initialize the objects in P it will try to use the default constructor (constructor that takes no arguments). Point doesn't have a default constructor so that's what the error message "no matching function for call to Point::Point()" is about.
Either create a default constructor or specify the constructor in the constructor initialization list.
1 2 3 4
Triangle::Triangle()
: P{{0,0},{0,0},{0,0}}
{
}
To make line 26-28 compile you would have to define operator(int, int) as a member of Point.
I learned in my C++ course that I can define a constructor like so
1 2 3 4 5
Point(int x1,int y1)
{
x = x1;
y = y1;
}
and then I can create an object like so inside main function:
Point P(0,0);
Is this not the correct method of using constructor? because that what I am doing in the Triangle constructor. Initializing the Point in the Triangle constructor.