Goldman Sachs Interview Question
Software Engineer / DevelopersOverriding - same method names with same arguments and same return types associated in a class and its subclass.
Overloading - same method name with different arguments, may or may not be same return type written in the same class itself.
overloading comes with in class for example :
Operator Overloading and Method overloading.
void Add( int i );
void Add( char c );
These two function declaration and definition in the same class is called method OVERLOADING.
overriding comes with two class ( base and drived class )
function in the base class is like
public virtual void Display();
function in the drived class is like
public override void Display();
this function overrides the base class .
Overriding - same method names with same arguments and same return types associated in a class and its subclass.
Overloading - same method name with different arguments, may or may not be same return type written in the same class itself.
overloading comes with in class for example :
Operator Overloading and Method overloading.
void Add( int i );
void Add( char c );
These two function declaration and definition in the same class is called method OVERLOADING.
overriding comes with two class ( base and drived class )
function in the base class is like
public virtual void Display();
function in the drived class is like
public override void Display();
this function overrides the base class .
Overriding - same method names with same arguments and same return types associated in a class and its subclass.
- Anonymous October 24, 2010Overloading - same method name with different arguments, may or may not be same return type written in the same class itself.
overloading comes with in class for example :
Operator Overloading and Method overloading.
void Add( int i );
void Add( char c );
These two function declaration and definition in the same class is called method OVERLOADING.
overriding comes with two class ( base and drived class )
function in the base class is like
public virtual void Display();
function in the drived class is like
public override void Display();
this function overrides the base class .