类的继承有关问题: 怎么让string的继承类从基类对象进行拷贝

类的继承问题: 如何让string的继承类从基类对象进行拷贝?
例如,我有一个需求,对std::string进行一些扩展。
我希望写个类叫做myString,从std::string公有继承,添加一些我自己特定的功能,和业务逻辑相关的。
遇到2个问题:

(1)拷贝构函数如何从另一个myString实例中初始化我自身? 因为myString并没有额外的成员,也就无法通过拷贝myString的各个成员来做到。
(2)我想有一个函数getString返回自身所包含的std::string的引用。

这2个需求该如何做到呢?

#include<string>
using namespace std;
class myString : public string
{
public:
        myString( const string& s )
                :string( s )
        {}
        myString( const myString& mys)
                :string( mys...//这里要如何用初始化列表把mys中包含的string,赋值给当前myString的string?
        {}
        const string& getString()
        {
                return ...//如何返回自身所包含的string呢? 如果不做额外拷贝而是返回这个string的引用的话。
        }
//... 我自己的一些函数
};

------解决方案--------------------
myString天生是string:

       myString( const myString& mys)
          :string( mys )
       {
        }


       const string& getString() const
       {
           return *this;
       }

  

不过,要重用string,最好的办法还是用组合而不是继承,虽然写起来麻烦一些。
------解决方案--------------------
事实上拷贝构造函数可以不写,编译器会为你生成一个,自动生成的版本会调用基类的拷贝构造函数,就向我给你写的那个实现一样。
------解决方案--------------------
基本上不用写太多代码。 但是std::string不是为了被继承的(没有虚析构函数), 这点需要注意。