Javatpoint.com is changed to TpointTech.com
C# Member OverloadingIf we create two or more members having same name but different in number or type of parameter, it is known as member overloading. In C#, we can overload:
It is because these members have parameters only. C# Method OverloadingHaving two or more methods with same name but different in parameters, is known as method overloading in C#. The advantage of method overloading is that it increases the readability of the program because you don't need to use different names for same action. You can perform method overloading in C# by two ways:
C# Method Overloading Example: By changing no. of argumentsLet's see the simple example of method overloading where we are changing number of arguments of add() method. Output: 35 60 C# Member Overloading Example: By changing data type of argumentsLet's see the another example of method overloading where we are changing data type of arguments. Output: 35 33.7 Next TopicC# Method Overriding |
Javatpoint.com is now changed to TpointTech.com, so we request you to subscribe our newsletter for further updates.
C# sealed keyword applies restrictions on the class and method. If you create a sealed class, it cannot be derived. If you create a sealed method, it cannot be overridden. Note: Structs are implicitly sealed therefore they can't be inherited. class C# sealed class cannot be derived by...
2 min read
In C#, base keyword is used to access fields, constructors and methods of base class. You can use base keyword within instance method, constructor or instance property accessor only. You can't use it inside the static method. C# base keyword: accessing base class field We can use the base...
3 min read
The term "Polymorphism" is the combination of "poly" + "morphs" which means many forms. It is a greek word. In object-oriented programming, we use 3 main concepts: inheritance, encapsulation and polymorphism. There are two types of polymorphism in C#: compile time polymorphism and runtime polymorphism. Compile time...
2 min read
If derived class defines same method as defined in its base class, it is known as method overriding in C#. It is used to achieve runtime polymorphism. It enables you to provide specific implementation of the method which is already provided by its base class. To perform...
1 min read
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India