Archived

This topic is now archived and is closed to further replies.

beginner_directx

Few stupid questions about inheritance

Recommended Posts

hi class object { protected: bool stupid; }; class human : public object { /* .. */ }; ... human dump; dump.stupid = TRUE; // Error ?? The question, would the variable ''stupid'' in ''dump'' be protected ? Another question, how to trace the count of the created instances ? a static var ? pointers ? The last question class human : public object { .. }; Can I change "Public" to anything else ( protected or private ) ? if yes, what will happen if I do ? thanx in advance http://uae-arts.host.sk

Share this post


Link to post
Share on other sites
Yes, stupid becomes protected in the derived class.
Yes, you can use a static member to count number of instances.
Yes, you can change public to private or protected (if you omit the access specifier it defaults to private for classes, public for structs). Search google for private inheritance and protected inheritance and you should get some good answers.

Share this post


Link to post
Share on other sites