Jump to content
  • Advertisement
Sign in to follow this  
Oggan

Make class-method act diferently depending on which subclass it got called from?(C++)

This topic is 4498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

well, the subject pretty much says it all.. i have a base-class, with 5 other classes derived from it. the base-class has a method which all of the sub-classes inherit. now when i call that method from one of the sub-classes, i want it to act differently depending on which sub-class it got called from. is there some fancy way of knowing which sub-class it got called from or will i have to specify that in a parameter when calling the method? thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Use a virtual function, which the classes which inhert override.

Share this post


Link to post
Share on other sites
Quote:
Original post by Zahlman
You should probably read the whole page actually.


People should probably read the whole site, actually.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!