Possible Duplicate:
What are the differences between struct and class in C++
I am looking at somebody header file for a structure, but it looks like functions are a part of this structure… so then this is a class but how to abstantiate? or use?
struct Recording
{
FLAG mode;
unsigned short intervals;
unsigned short saved_cycles;
virtual void SavetoFile( FILE *file,
bool Control,
PhaseData *__phaseData = NULL
);
virtual bool LoadfromFile( FILE *file,
bool Control,
PhaseData *__phaseData = NULL
);
};
In C++
classandstructare identical, except that the default access specifier for the former isprivate, while for the latter it ispublic.In the above code,
Fooinherits privately fromBasewhileBardoes so publicly. Similarly,Foo::iis private whileBar::iis public. Note that the visibility ofiin both cases has nothing to do with inheritance i.e. it’d be the same even ifFooandBardid not inherit fromBase.Other than these differences, everything that you can do with one, you can also do with the other.