私は基底クラスAと2つのクラスB、Cを持っています。メソッドfuncの宣言はクラスAで与えられます。 ?派生クラスで未定義の基本クラスのメソッドを定義する
class A {
public:
void func();
};
class B : public A {
//some members
};
class C : public A {
//some members
};
//define B's func here without changing the definition of the three classes
//define C's func here without changing the definition of the three classes
これはC++で_very_基本的なトピックであるとC++の本で覆われています。私はあなたが[C++の良い本](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list)を拾うことをお勧めします。 –
"virtual"ディレクティブを使用しないとできません。 A :: func()のアドレスはB :: func()またはC :: func()によって上書きされなければならず、レイトバインドを行う場合にのみ実行できます。 – Vink