Advertisement

struct syntax Q

Started by July 05, 2001 10:38 AM
1 comment, last by io 23 years, 7 months ago
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
Advertisement
thanks. i just noticed that my message got messed up when i sent it. was supposed to read:

struct "name" : "class"{
//whatever
};

This topic is closed to new replies.

Advertisement