Sign in to follow this  
slowmike

Class or Structure

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this