Hi
I cannot compile the following code:
Code:
#include <iostream.h>
int count = 0;
class point{
int x, y;
public:
point(int a=0, int b=0)
{
x=a;
y=b;
count++;
cout << "Point created: x=" << x << " y=" << y << endl;
}
void set(int a, int b)
{
x=a;
y=b;
}
void get(int &a, int &b)
{
a=x;
b=y;
}
void move(int a, int b)
{
x=x+a;
y=y+b;
}
~point()
{
count = count-1;
cout << " Point destroyed: x=" << x << " y=" << y << endl;
}
}
int quantity(){
return count;
}
int main()
{
cout << "Name of points:" << quantity() << endl;
point p1, p2(30), p3(50,70);
cout << "Number of points: " << quantity() << endl;
return 0;
}
error C2628: 'point' followed by 'int' is illegal (did you forget a ';'?)
error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class point' (or there is no acceptable conversion)
error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class point' (or there is no acceptable conversion)
What is wrong with my code?
Thanks