+ 1
How can i solve this error?
#include<iostream> using namespace std; class point{ public: int x,y; private: void get(); void show(); point addpoint(point p); }; void point::addpoint(point p) { point pt; pt.x = x+pt; pt.y = y+pt return pt; } void main() { point p1,p2,p3; p1.get(); p1.show(); p2.get(); p2.show(); p3= p1.addpoint(p2); p3.show(); }
1 Odpowiedź
+ 4
okay, theres couple of error here.
in your class, you declare "point addpoint(point p)"
which returning point. but you define it return void "void point::addpoint(point p)"
void get() and void show() is not defined yet.
all those methods is private. they cannot accessed from outside