Home > Back-end >  The copy constructor how to write ah I want to use the main function to initialize the tectonic line
The copy constructor how to write ah I want to use the main function to initialize the tectonic line

Time:10-30

#include
using namespace std;
The class point {
Public:
Point (int x, int y) : x (x), y (y) {}
Point () {x=0; Y=0; }
Point (point & amp; P) : x (p.x), y (p.y) {}
Const int getx () {return x; }
Const int gety () {return y; }
Private:
int x;
Int y;
};
The class line: {
Public:
The line (int x1, int y1, int x2, int y2) : p1 (x1, y1), p2 (x2, y2) {};
Private:
Point p1.
Point p2.
};
Int main () {
Line (l (1, 2), (2, 3));
return 0;
}

CodePudding user response:

Do not add parentheses to run add the BUG on the brackets
  • Related