b********e 发帖数: 693 | 1 class Base {
public:
Base();
~Base();
int getBaseNum();
private:
int baseNum;
};
class A : public Base {
public:
A();
~A();
float getBaseNum();
private:
float baseNum;
};
What concept does the sample code above represent?
A. Inheritance
B. Virtual Function
C. Polymorphism
D. Recursion
E. Function overloading |
h**k 发帖数: 3368 | 2 A and E. 按照wiki上的解释,polymorphism也包括function overloading,不过好像
很多人认为polymorphism只限于function overriding. |
y*******o 发帖数: 6632 | 3 my two cents:
this is not function overload at all. The base class function will be
disguised by the child class function. refer to effective c++
【在 h**k 的大作中提到】![](/moin_static193/solenoid/img/up.png) : A and E. 按照wiki上的解释,polymorphism也包括function overloading,不过好像 : 很多人认为polymorphism只限于function overriding.
|
s*****t 发帖数: 737 | 4 Agree with you, the base class method will got overriden and hiden by the
derived class.
【在 y*******o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : my two cents: : this is not function overload at all. The base class function will be : disguised by the child class function. refer to effective c++
|
h**k 发帖数: 3368 | 5 You are right. The two functions have the same function signatures.
【在 y*******o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : my two cents: : this is not function overload at all. The base class function will be : disguised by the child class function. refer to effective c++
|
l***x 发帖数: 21 | 6
He's right even if the two functions don't have the same signatures.
【在 h**k 的大作中提到】![](/moin_static193/solenoid/img/up.png) : You are right. The two functions have the same function signatures.
|
J******d 发帖数: 506 | 7 Agreed.
But can this be called polymorphism as well?
【在 y*******o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : my two cents: : this is not function overload at all. The base class function will be : disguised by the child class function. refer to effective c++
|