T
thomas
1.
---code--
class base{
public:
virtual void func();
};
class deriveublic base{
virtual void func(); //1
};
---code--
As we know that Line 1 implements the function overloading,
what's the difference between "virtual void func();" and "void
func();" in L1?
2.why people sometimes define constructor/destructor virtual?
what if a pure virtual constructor/destructor?
3.
--code--
int *x = new int[0];
cout<<x<<endl;
--code--
the result is not 0, what happened?
4. when calling "delete []p;", how does the program know how many
elements should be destroyed?
---code--
class base{
public:
virtual void func();
};
class deriveublic base{
virtual void func(); //1
};
---code--
As we know that Line 1 implements the function overloading,
what's the difference between "virtual void func();" and "void
func();" in L1?
2.why people sometimes define constructor/destructor virtual?
what if a pure virtual constructor/destructor?
3.
--code--
int *x = new int[0];
cout<<x<<endl;
--code--
the result is not 0, what happened?
4. when calling "delete []p;", how does the program know how many
elements should be destroyed?