|
-
March 21st, 2009, 09:30 AM
#3
Re: classes question
struct and class are identical in every way, except that when declaring methods and/or data members in a class, by default, they are treated as private members of the class. In a structure, by default, all methods and/or data are public.
Naturally, you can change the permission levels of methods and data members using the appropriate label of "public:", "protected:", or "private:".
Many s/w developers that program in C++ tend to use a class vs. a struct for modeling their objects. When only data members need to be encapsulated is a struct used. But that is just based on developer's preference.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|