|
-
April 22nd, 2005, 05:11 PM
#1
Inheriting question...
Hi ...
I have 3 classes : CBase(char *name)->C2DPoint(float x, float y)->C3DPoint(x, y, z coordinates). I have predefined all operators(+, -, *, /, +=, -=, *=, /=, <<, >>, =, copy constructor - all working properly).
In C3DPoint class I have :
Code:
C3DPoint::C3DPoint(const C2DPoint &ob) : C2DPoint(ob)
Here an example of the main() function :
Code:
int main()
{
C2DPoint a;
C3DPoint b;
cout << b + a; // working because of the method above
cout << a + b; // also working but i have no such method in
//C2DPoint class and the result is object
// of C2DPoint...it should be C3DPoint object
// in fact , it should not work at all I think
}
I hope that I've posted the problem clearly enough ... if it isn't I can attach the files ....
Thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|