What's the difference between overload and override

来源:互联网 发布:sqlserver中isnull 编辑:程序博客网 时间:2024/05/14 02:29

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 );};

原创粉丝点击