c++ - Coplien 表单示例 C++

标签 c++

我知道 Coplien 表单由以下部分组成:

  • 构造器
  • 析构函数
  • 复制构造函数
  • 运算符重载=

但是我不知道如何实现这个表单的每个部分...... 我已经知道如何执行构造函数析构函数,因为它非常简单,例如:

class Example
{
    public:

        /* Constructor  */
        Example();

        /* Destructor */
        ~Example();

        /* Copy constructor */

        /* Operation overload = */

};

我有一个问题:

-Copy constructor
-Operation overload

请给我一个 Coplien 表格的例子好吗?

最佳答案

复制构造函数是Example(const Example&),赋值运算符是Example& operator = (const Example& e)。您可以找到有关这些的一些信息 here .

关于c++ - Coplien 表单示例 C++,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21219590/

相关文章:

C++0x 和 Friend 函数以及 boost::make_shared

c++ - 使用线程访问数据库

c++ - 使用 C++ 模板时对复制构造函数的 undefined reference

c++ - 如何将 uint8* 转换为 uint32

c++ - 如何使用任务栏按钮显示进度条?

c++ - Cloud9 IDE : debug c++ application

C++ 获取 unordered_set *没有*序列化的字节表示

c++ - vector 上的for循环,总是返回一个索引

c++ - 我可以用静态版本替换共享库依赖项吗?

c++ - 如何正确使用enable_if?