質問はかなり簡単です。明確にするために、以下の例を考えてみます。クラス・メソッドはクラス・インスタンスのサイズを大きくしますか?
// Note that none of the class have any data members
// Or if they do have data members, they're of equal size, type, and quantity
class Foo {
public:
void foo1();
void foo2();
// 96 other methods ...
void foo99();
};
class Bar {
public:
// Only one method
void bar();
};
class Derived1 : public Foo { };
class Derived2 : public Bar { };
int main() {
Foo f;
Bar b;
Derived1 d1;
Derived2 d2;
return 0;
}
はインスタンスf
、b
、d1
を行い、そしてd2
全てがメモリに同じ量の空間を占有?この質問の延長として、Foo
のインスタンスをコピーすると、理論的にはBar
よりも長くかかりますか?
99方法? arrgh .. – Nim
@ニム:私は本当にポイントを取得したかった。;) – Zeenobit