Jump to content
  • Advertisement
Sign in to follow this  
slowmike

Class or Structure

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

How do you know when to create a structure and when to create a class? For example, I could create my own texture structure, but I could also create my own texture class. I could even create both. So how do you know which to use? Please don't limit your responses to dealing with textures only. Thank you.

Share this post


Link to post
Share on other sites
Advertisement
In what language? In C++, class and struct are the exact same thing except that a class has default private member access and inheritance, struct has default public member access and inheritance and they're spelled differently.

Share this post


Link to post
Share on other sites
It's not even that much of a difference since you can still use private in structs and public in classes. In general, I use struct if everything is public and class otherwise. It's usually less typing that way.

Share this post


Link to post
Share on other sites
Quote:
Original post by SiCrane
It's not even that much of a difference since you can still use private in structs and public in classes. In general, I use struct if everything is public and class otherwise. It's usually less typing that way.


Alright. Thanks for your replies.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!