Override indicates rewriting, which is used to inherit the Implementation of Virtual members in the base class.
Overload indicates overload. It is used to implement different parameters (including different types or numbers) of methods with the same name in the same class.
Example:
UsingSystem;
UsingSystem. Collections. Generic;
UsingSystem. text;
NamespaceExample07
{
ClassProgram
{
ClassBaseclass
{
Public Virtual VoidF ()
{
Console. writeline ("Baseclass. F");
}
}
ClassDeriveclass: baseclass
{
Public Override VoidF ()
{
Base. F ();
Console. writeline ("Deriveclass. F");
}
Public VoidAdd (IntLeft,IntRight)
{
Console. writeline ("Add for INT: {0 }", Left + right );
}
Public VoidAdd (DoubleLeft,DoubleRight)
{
Console. writeline ("Add for INT: {0 }", Left + right );
}
}
Static VoidMain (String[] ARGs)
{
Deriveclass tmpobj =NewDeriveclass ();
Tmpobj. F ();
Tmpobj. Add (1, 2 );
Tmpobj. Add (1.1, 2.2 );
Console. Readline ();
}
}
}
Result:
Baseclass. f
Deriveclass. f
Add for INT: 3
Add for INT: 3.3