Computer Science Canada Inheritance/Constructor problem |
Author: | Dwindle [ Mon Mar 27, 2006 10:50 am ] | ||
Post subject: | Inheritance/Constructor problem | ||
I get an error at the Derived constructor line when I try to compile. Apparently the x and y fields don't exist but I know it does since it's inherited from the base class. Also if I put it as normal assignment statements inside the brackets it'll work but I really shouldn't have to do that should I? This is the simplified version of an actual program I'm working on and I wanted to split up the initializing variables part of the contructor from some stuff I actually wanted it to do. I'm using Dev-Cpp and I'm wondering if this code works ok for other people. Also how do I indent certain lines when I post? I tried just adding spaces before but that doesnt work. |
Author: | wtd [ Mon Mar 27, 2006 12:47 pm ] | ||||
Post subject: | |||||
Use code tags.
As for your problem... why are you not simply calling the Base class' constructor from the Derived class? |
Author: | Dwindle [ Mon Mar 27, 2006 8:15 pm ] |
Post subject: | |
thanks, both problems solved. |