Date: Wed, 6 Apr 2022 21:12:33 +0100
On Wed, 6 Apr 2022, 8:21 pm Bo Persson wrote:
>
> What are the odds that I *always* need to call all base class methods?
> And in that order?
>
> Perhaps I only need to call three of them?
>
If you have such in-depth knowledge of all the base classes then just call
them individually in whatever order you like and with whatever arguments
you like:
void Method(int arg)
{
this->Base3::Method(arg);
this->Base1::Method(arg + 1u);
this->Base2::Method(arg - 1u);
}
However if you only know that you don't want to invoke Base4's function
then exclude it as follows:
void Method(int arg) continue(!Base4)
{
continue(...); // This will do Base1, Base2, Base3
}
>
> What are the odds that I *always* need to call all base class methods?
> And in that order?
>
> Perhaps I only need to call three of them?
>
If you have such in-depth knowledge of all the base classes then just call
them individually in whatever order you like and with whatever arguments
you like:
void Method(int arg)
{
this->Base3::Method(arg);
this->Base1::Method(arg + 1u);
this->Base2::Method(arg - 1u);
}
However if you only know that you don't want to invoke Base4's function
then exclude it as follows:
void Method(int arg) continue(!Base4)
{
continue(...); // This will do Base1, Base2, Base3
}
Received on 2022-04-06 20:10:15