jmasterx
jmasterx

Reputation: 54113

Calling the base class's implementation from the derived?

I want to do what the base does, but then I want to add some derived stuff.

I tried the following but it did not work: (this function is virtual in AguiWidget)

void AguiLabel::onSizeChanged( const AguiSize &size )
{
    AguiWidget.onSizeChanged(size);
    updateLabel();
}

Thanks

Upvotes: 3

Views: 1321

Answers (4)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798576

Close.

AguiWidget::onSizeChanged(size);

Upvotes: 2

Mark Ransom
Mark Ransom

Reputation: 308130

You were almost there, just one small syntax change.

AguiWidget::onSizeChanged(size);

Upvotes: 2

Drew Hall
Drew Hall

Reputation: 29047

Change AguiWidget.onSizeChanged(size); to AguiWidget::onSizeChanged(size);.

Upvotes: 6

lijie
lijie

Reputation: 4871

Use the scoping operator :: (i.e. AguiWidget::onSizeChanged(size))

Upvotes: 2

Related Questions