
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Overloading in C#
Overloading is of two types in C#.
Function Overloading
You can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list.
Let us see an example −
public static int mulDisplay(int one, int two) { } public static int mulDisplay(int one, int two, int three) { } public static int mulDisplay(int one, int two, int three, int four) { }
Operator Overloading
Overloaded operators are functions with special names. The keyword operator is followed by the symbol for the operator being defined.
public static Box operator+ (Box b, Box c) { Box box = new Box(); box.length = b.length + c.length; box.breadth = b.breadth + c.breadth; box.height = b.height + c.height; return box; }
- Related Questions & Answers
- Constructor Overloading in C#
- Constructor Overloading in C++
- Overloading unary operators + in C++
- Overloading unary operator in C++?
- What is overloading in C#?
- What is method overloading in C#?
- Rules for operator overloading in C++
- Overloading array index operator [] in C++
- Increment ++ and Decrement -- Operator Overloading in C++
- How to use Operator Overloading in C#?
- How to implement operator overloading in C#?
- Function overloading and return type in C++
- Function overloading and const keyword in C++
- PHP Overloading
- What is overloading a unary operator in C++?
Advertisements