How does the parent c++ constructor in the child class?

I have a class Figure, which has composition of Point objects. From the Figure inherited Hline and Vline. It is assumed that both use the composition Point, but draw differently. Decided to postpone the creation of the song in the constructor, but do not know how the parent will work in the child.

In General: as the parent constructor will run in the child class? Will I have to call it manually and if so how?
March 20th 20 at 11:25
1 answer
March 20th 20 at 11:27
Solution
as the parent constructor will run in the child class?

The constructors of all parent classes in the inheritance hierarchy of the class of the object will be invoked before the body of the constructor of its class. The class constructor can choose which designers the parents will be called and with what arguments. Something like this:
class A
{
public:
A();
A(int);
};

class B: public A
{
 static int f(int);
public:
 B(): A()
{
}
 B(const char *): A(42)
{
}
 B(int v): A(f(v))
{
}
};


If you do not choose-are called default constructors, if not -- it's a compile-time error.

Find more questions by tags OOPC++