I am trying to understand some C++ code and find that my C++ is a little rosty. Amongst others the code features the following class structure (CLASS1
to CLASS3
not shown for brevity):
class CLASS4
:public CLASS3
,public CLASS2{
public:
CLASS4(double VARA, double VARB, char VARC, int VARD, double VARE, std::vector<double> VARF, std::string VARG = "")
throw(Error);
CLASS4(const CLASS4&);
~CLASS4();
double METHOD1();
protected:
void METHOD2();
};
CLASS4::CLASS4(double VARA, double VARB, char VARC, int VARD, double VARE, vector<double> VARF, string VARG) throw(Error)
:CLASS1(VARC, VARD, VARE, VARF, VARG)
,CLASS2(VARB)
,CLASS3(VARA, VARC, VARD, VARE, VARF, VARG){}
CLASS4::CLASS4(const CLASS4& VARH)
:CLASS1(VARH), CLASS2(VARH), CLASS3(VARH){}
CLASS4::~CLASS4(){}
I understand the object concept and the concept of inheritance. I see the constructor and destructor of CLASS4
. What I do not understand is the listing of classes in the inheritance :public CLASS3, public CLASS2
. Whats the purpose of it? Furthermore I wonder what the throw(Error)
is supposed to do. Also I wonder what the purpose of the second constructor CLASS4(const CLASS4&);
is. I am aware that this will be a simple problem for a C++ programmer.