What Is The Concept Of Overloading, Overriding, Encapsulation, Abstraction With Code In C++ And C#?
1 Answer - Sort by: Date | Rating
Operator overloading allows programmers to use the existing operators so that they can be used with user defined data types. The programmer provides a function definition to that specifies the return data type followed by keyword 'operator ' and the operator that is to be overloaded. Then the operation of the operator is defined in the body of that function and the operands are provided as arguments to the function. For example, plus operator will be overloaded for an object of class point having data members x and y as follows:
point operator+(point p1)
{
point temp;
temp.x=x+p1.x;
temp.y=y+p1.y;
return point;
}
Overriding is the process of defining a function in the child class with same name. In this way the child class method hides parent class method. Method overriding is used to provide different implementations of a function so that a more specific behavior can be realized.
Perhaps the most important concept of object orientation is abstraction. The basic idea of abstraction is to hide the low-level implementation details and to provide a simple interface. It provides two important benefits. One is the simplicity and clarity of coding and second is the ease of modification.
Encapsulation is used to implement abstraction. In encapsulation we combine the data and methods that operate on the data and put them in a single unit. An interface is provided to interact with this unit. An example of abstraction is the class definition in which data and methods are combined together.
point operator+(point p1)
{
point temp;
temp.x=x+p1.x;
temp.y=y+p1.y;
return point;
}
Overriding is the process of defining a function in the child class with same name. In this way the child class method hides parent class method. Method overriding is used to provide different implementations of a function so that a more specific behavior can be realized.
Perhaps the most important concept of object orientation is abstraction. The basic idea of abstraction is to hide the low-level implementation details and to provide a simple interface. It provides two important benefits. One is the simplicity and clarity of coding and second is the ease of modification.
Encapsulation is used to implement abstraction. In encapsulation we combine the data and methods that operate on the data and put them in a single unit. An interface is provided to interact with this unit. An example of abstraction is the class definition in which data and methods are combined together.
0
0
Good explanation!!!1thanks a lot
Good Explanation!
- What Do I Do On Meez If It Says Your Input Is Not Correct And It Is?
- State The Output That Will Be Produced By The Following C++ Program : #include #include Int Square (int Y ) { Return Y*y; } Void Main ( ) { For(int X=1;x?
- What Is The Input Electric On A Dsi?
- What Are The Classified Input In Economists?
- What Are The Classified Input Had Economics?
- What Is Input Technologies Trends?
- What Are The Input Technologies?
- What Floods Include Weatherwise?
- Why Are Economists Input As Timeless?
- What Is An Example Of An Input Devise?
- How To Make A Simple Programming?
- Where Can I Learn DirectX Or OpenGL In C++?
- What Does |= And &= Means In C++?
- What Is Input From Technology Means?
- Write A Program In C/C++ To Implement Cohen-Sutherland Line Clipping Algorithm. In This Implementation, Consider Two Cases Of A Line: Totally Visible, Totally Invisible, Against The Rectangular Clipping Window?
- Can Somebody Tell Me Why This Code Will Not Compile: #include "Stdafx.h" //added This Include #include //added Stream To Io Using Namespace Std; Int Main() { //declare Variables Int Choice=0; Std::cout?
- Sample Program Which Requires 2 Numbers, Input 1 And Input Which Will Be The Start Of A Fibonacci Series?
- Sample Program Which Requires 2 Input For Fibonacci Series?
- What Is Input Stream?
- How Do I Input Answers?
- How Do I Write A Program To Compute The Standard Deviation Of 5 Input Values. Create A Constant For The Number Of Values (5). Ask The User For The Numbers. Next, Compute The Mean (sum Divided By 5)?
- What Are Link Lists In C++?
- Where Can I Download C++ Programmes File?
- How To Figure Out The 2 Operations That Result In The Given Numbers On An Input/output Machine?
- What Do U Mean By Abstraction And Encapsulation?
- What Is The Difference Between Aggregation, Abstraction And Encapsulation?
- Distinguish Between Data Encapsulation And Data Abstraction?
- Why Is The Overloading Concept Not Used In Java?
- What Does Encapsulation Mean?
- What Is Meant By Overriding?
- What Is Encapsulation In Java?
- What Is Meant By Encapsulation In C++?

New Comment - Comments are editable for 5 min.