我创建了一个从字符串类公开继承的新类。我希望超载派生类中的<
(小于)运算符。但是从重载函数我需要调用父类<
运算符。调用这个函数的语法是什么?如果可能,我希望将该运算符作为成员函数来实现。如何从重载函数调用父类成员函数?
在Java中有super
这个关键字。
我的代码如下。
#include<iostream>
#include<string>
using namespace std;
class mystring:public string
{
bool operator<(const mystring ms)
{
//some stmt;
//some stmt;
//call the overloaded <(less than)operator in the string class and return the value
}
};
是''string'的std :: string'? –
是std :: string –
谢谢你的link.I需要在父类中调用less运算符的语法。 –