struct syntax Q
i recently saw an example where someone used the following syntax:
struct :
{
//stuff
};
can structures inherit in c++? i''ve never seen this use before, and was wondering, why not use a class instead? any benefit from using this?
AFAIK, in C++ the only different between a class and a struct is the default private/public properties.
Example:
class CLASS {int X; };
struct STRUCTURE {int X; };
the only difference is that in CLASS, X is private and in STRUCTURE, X is public.
That only applies to structures in C++.
(You can conclude that if that''s the only difference, then structs can inherit just like classes..).
Oren.
http://qsoft.cjb.net
Example:
class CLASS {int X; };
struct STRUCTURE {int X; };
the only difference is that in CLASS, X is private and in STRUCTURE, X is public.
That only applies to structures in C++.
(You can conclude that if that''s the only difference, then structs can inherit just like classes..).
Oren.
http://qsoft.cjb.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement