Returning object as based class: is it a problem?

前端 未结 0 883
失恋的感觉
失恋的感觉 2020-11-28 05:31

Assume I have:

class A {
int i;
}

class B : public A {
int j;
A base() { return *this; }
}

Is this legal C++ ? Or will I run into slicing pr

相关标签:
回答
  • 消灭零回复
提交回复
热议问题