开发者

Calling the base class's implementation from the derived?

开发者 https://www.devze.com 2023-01-26 09:24 出处:网络
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)

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);
    upd开发者_如何学编程ateLabel();
}

Thanks


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


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


You were almost there, just one small syntax change.

AguiWidget::onSizeChanged(size);


Close.

AguiWidget::onSizeChanged(size);
0

精彩评论

暂无评论...
验证码 换一张
取 消