gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
c++ __super 可以跨编译器吗
- User
c++ __super 可以跨编译器吗
- Assistant
__super是微软Visual C++编译器的扩展功能,该功能允许在子类的成员函数中调用基类的同名函数。因此,__super不能跨编译器使用。其他编译器都没有此功能,因此在其他编译器中使用__super将导致编译错误。
- User
gcc 没有类似的功能吗
- Assistant
GCC没有__super这个功能,但是可以使用基类名称加上作用域解析符 "::" 的方式显式调用基类中的同名函数。例如:
class Base { public: void foo() { ... } }; class Derived : public Base { public: void foo() { Base::foo(); // 调用基类Base中的foo()函数 ... // 自身的其他操作 } };在基类函数比较多的情况下,这种方式可能会比较繁琐,但是是可行的。
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.