constructor implementation using inheritance


Hello guys,

I have recently started to use the OSGart project and it is all written in c++. I would like to ask some simple questions about the following constructor that I try to use.

this is the implementation code:

DoubleMarkerCallback::DoubleMarkerCallback(Marker* markerA, Marker* markerB) :
osg::NodeCallback(),
m_markerA(markerA),
m_markerB(markerB)
{
}

It is the c'tor of "DoubleMarkerCallback".
the ":" operator -after this parenthesis -> (Marker* markerA, Marker* markerB) - specifies inheritence?
so the c'tor inherits members from the three
osg::NodeCallback(),m_markerA(markerA),m_markerB(markerB) ??
I understand that the c'tor can inherit from the osg::NodeCallback() because the declaration of the class is the following

class OSGART_EXPORT DoubleMarkerCallback : public osg::NodeCallback
{
public:

DoubleMarkerCallback(Marker* markerA, Marker* b);

protected:

Marker* m_markerA;
Marker* m_markerB;

};


what about the
m_markerA(markerA),
m_markerB(markerB)
these two - m_markerA, m_markerB - are protected members of the class. Is this a way to give values to the protected members? if so...why doesn't the writer give these values inside the "{}" part but leaves it empty?

Thank you all in advance and sorry for the silly question, I just can't find out what is really happening

Stef

Last edited on
There is not any silly question from beginner but lazy hands to search the answer first. Any C++ syntax you don't know, there must be many resources talking about it in this world. What you asked is called constructor initialization list, I'd suggest the book below to get clear answer from it.

http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html
Last edited on
Topic archived. No new replies allowed.