Re: Points and Slicing???


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

Posted by Brian Begnoche on April 16, 2001 at 01:29:20:

In Reply to: Points and Slicing??? posted by Earl Wong on April 16, 2001 at 00:30:00:

: I get the following error when I try to assign a derived class pointer to its base class.
: "error C2243: 'type cast' : conversion from 'class plant *' to 'class creature *' exists, but is inaccessible"
: Any help or ideas to tackle the problem would be greatly appreciated thanks
: Earl

Well, I have one idea. Did you forget to specify an access mode when you inherit your derived class? If so, it uses private as the default, and in that case the casting of pointers is restricted. Look at slides 1 and 2 of the "Controlling Inheritance" slides.




Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]