by Dinesh Thakur Category: Classes in C++

Overloading: When a single Object has multiple behaviors. Then it is called as Overloading. Overloading is that in which a Single Object has a same name and Provides Many Functions. In Overloading followings things denotes Overloading:-


1)      When an Object has Same Name.
2)      Difference is Return type.
3)      Difference in Function, with Multiple Arguments.
4)      Difference in Data Type.

1)   Constructor Overloading: Constructor overloading is that in which a Constructor has a same name and has multiple Functions, then it is called as Constructor Overloading. As we Know that Constructor are of Default, Parameterized and Copy Constructors. So that when we are creating a Single Constructor with Multiple Arguments then it is called as Constructor Overloading.
2)   Operator Overloading: As we know that Operators are used for Performing Operations on the Operands. But Each and Every Operator has Some Limitations Means an Operator which is also called as Binary are used for Performing Operations on the two Operands and Unary Operators performs their Operation on the single Operand.
So with the help of Operator Overloading, we can Change the Operation of the Operator. Means With the help of Operators we can Change the Operation of the Operators. For Example with the help of Binary Operators we can add two Objects Means not only the two Data Members of the Class, This will add all the Data Members of the Class.
So Like this Way we can Also Change the Behavior of the Unary Operator Means Unary Operators are used for Performing the Operation on the Single Operand. But With the help of Operator Overloading we can Change the behavior of the unary Operator means we can perform Operations means we can Increase or Decrease the values of two or more Operands at a Time.
And With the Help of Comparison Operators we can also compare the Two Objects Means all the Data Members of one Object can be compared with the Data Members of the Other Object. Without the help of Operator Overloading this is not possible to compare two Objects. So with the help of Comparison Operators we can compare two Objects.
3) Method Overloading: - Method Overloading is also called as Function Overloading. Overloading Means a Functions  has many Behaviors occurred When in class when a functions has same name but different behaviors A Functions said to be overloaded When :-


Ø    Function has same Name but Different Return Type
Ø    Difference in No of Arguments
Ø    Different Return Type in Arguments

When We Pass a Call for Execution then it will match the Criteria of Function like Number of Arguments and Data types etc.

Overloading: When a single Object has multiple behaviors. Then it is called as Overloading. Overloading is that in which a Single Object has a same name and Provides Many Functions. In Overloading followings things denotes Overloading:-

1)      When an Object has Same Name.

2)      Difference is Return type.

3)      Difference in Function, with Multiple Arguments.

4)      Difference in Data Type.

1)   Constructor Overloading: Constructor overloading is that in which a Constructor has a same name and has multiple Functions, then it is called as Constructor Overloading. As we Know that Constructor are of Default, Parameterized and Copy Constructors. So that when we are creating a Single Constructor with Multiple Arguments then it is called as Constructor Overloading.

2)   Operator Overloading: As we know that Operators are used for Performing Operations on the Operands. But Each and Every Operator has Some Limitations Means an Operator which is also called as Binary are used for Performing Operations on the two Operands and Unary Operators performs their Operation on the single Operand.

So with the help of Operator Overloading, we can Change the Operation of the Operator. Means With the help of Operators we can Change the Operation of the Operators. For Example with the help of Binary Operators we can add two Objects Means not only the two Data Members of the Class, This will add all the Data Members of the Class.

So Like this Way we can Also Change the Behavior of the Unary Operator Means Unary Operators are used for Performing the Operation on the Single Operand. But With the help of Operator Overloading we can Change the behavior of the unary Operator means we can perform Operations means we can Increase or Decrease the values of two or more Operands at a Time.

And With the Help of Comparison Operators we can also compare the Two Objects Means all the Data Members of one Object can be compared with the Data Members of the Other Object. Without the help of Operator Overloading this is not possible to compare two Objects. So with the help of Comparison Operators we can compare two Objects.

3) Method Overloading: - Method Overloading is also called as Function Overloading. Overloading Means a Functions  has many Behaviors occurred When in class when a functions has same name but different behaviors A Functions said to be overloaded When :-

Ø    Function has same Name but Different Return Type

Ø    Difference in No of Arguments

Ø    Different Return Type in Arguments

When We Pass a Call for Execution then it will match the Criteria of Function like Number of Arguments and Data types etc.



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles