【发布时间】:2011-06-18 05:15:22
【问题描述】:
谁能给我以下 OOP 概念的名称(如果它确实是一个 OOP 概念!):
我有两个类:A 和 B。两者都有说,每个 2 个方法(都不同)。现在我创建第三个类 C。现在我想将 A & B 的所有方法公开给 C。下面是某种演示:
class A
int method_in_A_one() {
}
int method_in_A_two() {
}
end
class B
int method_in_B_one() {
}
int method_in_B_two() {
}
end
class C
C() {
A an_instance_of_a;
B an_instance_of_b;
}
}
Now I want to be able to do this:
C instance_of_c = new C;
insance_of_c.method_in_A_one();
insance_of_c.method_in_A_two();
insance_of_c.method_in_B_one();
insance_of_c.method_in_B_two();
我还没有真正使用它,但我确信有一个特定的概念来处理它。在此先感谢,呃。
【问题讨论】:
-
我猜你的意思是 B an_instance_of_b;而不是 B an_instance_of_c; ?
-
是的,对不起,我现在改正,谢谢:)
标签: oop terminology