avatar
another c++ question# JobHunting - 待字闺中
b*e
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
avatar
h*k
2
A and E. 按照wiki上的解释,polymorphism也包括function overloading,不过好像
很多人认为polymorphism只限于function overriding.
avatar
y*o
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 的大作中提到】
: A and E. 按照wiki上的解释,polymorphism也包括function overloading,不过好像
: 很多人认为polymorphism只限于function overriding.

avatar
s*t
4
Agree with you, the base class method will got overriden and hiden by the
derived class.

【在 y*******o 的大作中提到】
: 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++

avatar
h*k
5
You are right. The two functions have the same function signatures.

【在 y*******o 的大作中提到】
: 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++

avatar
l*x
6

He's right even if the two functions don't have the same signatures.

【在 h**k 的大作中提到】
: You are right. The two functions have the same function signatures.
avatar
J*d
7
Agreed.
But can this be called polymorphism as well?

【在 y*******o 的大作中提到】
: 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++

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。