im asked to create a class and have it be publicly inherited by the string class. The way I have thought about this is that because my new class will inherit all protected and public members of the string class, any object I create will essentially be a string. If that's incorrect, please tell me what is right.
Assuming Im right though, I should be able to do this:
1 2 3
newClass object = "Hello";
cout << object;
If I have to overload the ofstream operator, thats fine I can do that. But Im more concerned about what I said at the top. If I'm wrong, I would like to know just how to make that small segment of code work. Thank you
^^ thats what my assignment is though. I have to inherit from the string class. If the answer to my problem is overloading some operators then thats ok with me.
Also my teacher says not to use any strings as variables in my new Class. What can I do?