0

クラスのすべてのパブリック メンバーの値のコピーを保持する方法。各メンバーにアクセスして明示的なコピー関数を作成することはオプションではありません。これは、同じクラスの多くの可能な定義の 1 つを使用してプログラムをコンパイルできるためです。

例: そのような 2 つのクラスは

file: Try1.cpp
    class top
    {public: int a;
    int b;}

file: try2.cpp
    class top
    {public: int c;
    int d;}

file: main.cpp
    main()
    {
    //save all public members of top
    // do operations on 'top' which may change its member variables
    // check if member variables value changed, may need to restore them
    }

プロジェクトのビルド中に、try1.cpp または try2.cpp ファイルの 1 つだけが含まれます。

4

0 に答える 0