Jump to content
  • Advertisement
Sign in to follow this  
Nokame

simple class question

This topic is 3741 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

My question is simply, if i use the following code: class region : public outdoor, public inside { .... }; and create an instance of the region class, is it the same as having 1 region object, 1 outdoor object, and 1 inside object? if this isn't the case would someone indulge me a bit?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
and create an instance of the region class,
Then all you have is 1 region object. That region object is an instance of the region class, which you created.

Read the topic multiple inheritance (I'm guessing you are working with C++ code) in your book to see what the code actually does.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nokame
is it the same as having 1 region object, 1 outdoor object, and 1 inside object?


It depends on what you mean by "same as". You will end up with one object. In that way no you don't have three separate objects with their own storage. It will have all of the fields and functions of all three classes so in that way yes.

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!