Is it possible to invoke the constructor of the ancestor bypassing the constructor of a parent?

There are 3 classes:
class GrandFather {
public: 
 GrandFather(int Capital)
{
Postcoitum();
}
};
class Father:public GrandFather{
public:
 Father(int Capital):GrandFather(Capital)
{
Kopfsalat();
}
};
class Son:public Father{
public:
 Son(int Capital):Father(Capital)
{
Cupiditate();
}
};


How to make so that the constructor of class Son would cause the class constructor GrandFather, but did not cause the constructor of the Father?

While made so: added Father designer

Father(int Capital, int x):GrandFather(Capital){}

and the Son did constructor Son(int Capital):Father(Capital,1).

But I would like a solution without extra lines.

Thanks in advance.
October 8th 19 at 01:04
5 answers
October 8th 19 at 01:06
Solution
Same questionreally about Java.
Saying that you can't because that is wrong. Perhaps it is so. - orpha_Bay commented on October 8th 19 at 01:09
October 8th 19 at 01:08
It is assumed that the constructor is intended to initialize fields of a class, for example, those that are dynamic objects. In this case, it appears a strange thing, a field (in the parent) we have, and its initialization code is not called. This is incorrect.

The business logic in the designer should not be placed, the function of the "Kopfsalat" must be submitted from the designer specifically for this place. Thus, the problem will solve itself.
October 8th 19 at 01:10
There is an old rule that if there is a need to write ugly code, so in the design a mistake. If there is a need for such a constructor call, as you described, it is necessary to rethink the organization of the class hierarchy.
October 8th 19 at 01:12
Is it possible to do the aggregation instead of inheritance?
Aggregation of Father to Son will still cause Kopfsalat() in the initialize Father, which should be avoided. - orpha_Bay commented on October 8th 19 at 01:15
October 8th 19 at 01:14
Make two constructors Father, one buys a dog and the other is not buying it, and get the one that you need. Or, as you yourself suggested, you can pass the attribute talking about the usefulness of this action
Father(int capital, bool need_to_buy_god);


Generally, in C++ it is impossible not to call a constructor when creating an object, you can only choose which of the constructors will be invoked.

Find more questions by tags C++