What Is The Concept Of Overloading, Overriding, Encapsulation, Abstraction With Code In C++ And C#?

6

6 Answers

Anonymous Profile
Anonymous answered
Encapsulation is a powerful concept available ic c++.To understand this concept let's take a example of bank Scenario.
Without encapsulation: It is very difficult job for us to manage the account details of the account holders,here each account needs to be maintained seperatly.
With encapsulation: You can bind the account deatils inside a single unit called class Bankaccount and by creating the instance of the class you can maintain the multiple acoount .
It also provides the security by using access specifier.So we can claim that it provides data hiding and data binding features.
Another Definition: Hiding the implementation part from the users is called encapsulation
raaga Profile
raaga answered
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.
Anonymous Profile
Anonymous answered
Wrapping up of data and function into single unit
used as data hiding
Wade Arnold Profile
Wade Arnold answered
Encapsulation means Wrap pind of data and function into a single unit.

In an object-oriented
programming language
encapsulation is used to refer to one
of two related but distinct notions, and sometimes to the combination thereof:
  • A language mechanism for restricting access to some of the object's components.
  • A language construct that facilitates the bundling of data with the
    methods operating on that data.

Programming language researchers and academics generally use the
first meaning alone or in combination with the second as a distinguishing
feature of object oriented programming
. The second definition is
motivated by the fact that in many OOP languages hiding of components is
not automatic or can be overridden; thus information hiding is defined as a
separate notion by those who prefer the second definition.
Gopinath Sundaram Profile
Encapsulation is hiding the implementation details.For eg: You drive the car using the steering,geer and the implementation(engine,etc) is hidden from you and you need not know those details.This is Encapsulation.
Anonymous Profile
Anonymous answered
Overriding :-Overriding is the process of defining a function in the child class with same name.
Overloading:-

Answer Question

Anonymous