Newbie here. I am looking at a company code.
It looks like there is no member element in class A, but in constructor A it initializes object B, although class A does not contain any member variable of type B (or any member variable at all!).
I think I don’t understand this enough to even ask a question ... so what happens here !? My intuition is that you need a variable before trying to initialize it. How is this possible (or what does it do well) to initialize an object without an object?
.h:
class A: public B
{
public:
A(bool r = true);
virtual ~A;
private:
}
.cpp
A::A(bool r) : B(r ? B::someEnumeration : B::anotherEnumeration)
{
}
A::~A()
{
}
Please, help.
Thanks JBU
source
share