您的位置:首页 > Web前端

What's the difference between overload and override

2011-05-18 13:06 260 查看
Overload means same function name defined in the class, but with different parameters. It's just about the polymophysm.

void func( int );
void func( double );
void fund( unsigned int );

Override means same function name with the same arguments, but defined in the parent and child class. It always used for inheritence.

class A
{
public:

void func( int );
};

class B : public A
{
public:

void func( int );
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: