Class or Structure

Started by
3 comments, last by slowmike 16 years ago
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.
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.
Yes, I'm using C++. So that's it? Data protection is the only real difference?
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.
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.

This topic is closed to new replies.

Advertisement