I am getting stuck with a homework which requires a self-build class called string_extend that inherits from class string. The string_extend class below is my code, and the main() part is the requested part for homework.
class string_extend:public string{
public:
string_extend(const string& str):string(str){}
};
int main(){
string_extend a("amd");
string_extend b(a);
cout<<a<<b;
}
Could anyone give any hint about how to inherit all the functions from class string?
using stdelsewhere in your code. His comment meant to say that it is not a good practice; neither is inheriting from a type defined in the Standard C++ library.