C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Derived class's function invokes base class's function

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 6 Apr 2022 19:22:31 +0100
On Wed, 6 Apr 2022, 5:26 pm Chris Ryan via Std-Proposals, <
std-proposals_at_[hidden]> wrote:

>
> Or this case:
> void Derived::Method()
> {
> //pre-process
> Base::Method();
> //post-process
> }
>
>

Use the 'continue' keyword inside the function body, invoking it with
parentheses as though it were a function, as follows:

void Derived::Method(int arg) continue
{
    //pre-process

    continue(arg);

    //post-process
}

If the 'continue(arg)' statement is omitted from the function body then it
is implied to be the first statement in the function. That is to say, the
following two implementations are identical:

void Derived::Method(int arg) continue
{
    continue(arg);

    //post-process
}

void Derived::Method(int arg) continue
{
    //post-process
}

Futhermore if you want to invoke the 'continue' function with exactly the
same arguments as the derived function, then use three dots:

    continue(...);




>

Received on 2022-04-06 18:20:12