如: class A
{
int array[] = {1,2,3,4,5}
}
class B extends A
{
int new_array[];
}
现在在这里,我想在B类是new_array应该是包含在A级相同的元素阵列 注: 我要复制,但我们需要注意的是,当我们在复制数组中进行任何更改时,更改应该“不”反映在原始数组中。
在C++类中,如何从另一个子集内访问超集的变量?这只能在视觉上作为你理解的例子。 中央情报局在总统之上,有权保留总统的机密信息。 class CIA {
public:
bool aliensExist = true; // 100%
};
class President {
public:
bool doAliensExist() {
return al
最后,我想在调用超类方法后调用子类方法。我有一个代码是这样的: public class SuperClass
{
protected WrapperClass<T> GetWrapperClass<T>()
{
return new WrapperClass(someStuff).Wrap<T>();
}
public SuperClass
class Super
{
Super()
{
System.out.println("This is Super Constructor");
}
}
class Sub extends Super
{
Sub()
{
//super() is automatically added by the compiler