Win Surprise Gifts!!!
Top 5 Contributors of the Month
Simon Robert VoIP
Post New Question
Subscribe to Forum
Example for encapsulation
December 30, 2010
Can any one give me real time example for Encapsulation
Posted Date: December 31, 2010 Points: 10
Encapsulation can be easily understood by the below real time examples:
Example No 1:
Data encapsulation is a technique used to protect the information in an object from the other object.
real time example : TV operation
it is encapsulated with cover and we can operate with remote and no need to open TV and change the channel. here everything is in private except remote so that any one can access not to operate and change the things in TV
Example No 2:
Data Encapsulation tecnique is only used with Object Oriented Programming, in this technique a class is having object(s) which only gives the functionality of that class but not the detail of the procedure followed by the function in the class.
Let's take example of Car and Car Manufacturer
Suppose you are a Car Manufacturer and you designed and developed a car design(class), now by using machinery you are manufacturing a car(object) for selling, when you sell your car the user only learn how to use the car but not that how this car works.
This means that You are creating the class with function and by making object(capsule) of it you are making availability of the functionality of you class by that object and without the interference in the original class.
Now some Programming level discription:
All the OOP programming languages such as C++, C#, Java
etc is having a concept of class and instance/object of a class, you can implement encapsulation by creating a class with some
functions and then create the object of that class, and acess the functionality of the functions of that class through object of that
All this is encapsulation and this is most basic property of a object oriented programming paradigm.
Note: Encapsulation is only, can be used in Object Oriented Programming Paradigm, not in non-OOP paradigm.
Posted Date: December 31, 2010 Points: 5
Nice examples... thanks
Mark as Answer if the answer solves your issue!!!
Posted Date: January 03, 2011 Points: 5
Great job Gautam...
Keep it up
Posted Date: January 22, 2011 Points: 5
* The Data Encapsulation is one of the piller of OOPs.
* Putting data and related function in a class called as "Data Encapsulation".
Posted Date: September 18, 2011 Points: 20
An object is nothing when it doesn't encapsulate data/behavior (class members)
Car is an object which encapsulates brek,seat,mirror/speed,acceleration etc
Posted Date: November 26, 2011 Points: 20
-is nothing but wrapping the data and functions into single entity.
cars and owners...
all the functions of cars are encapsulated with the owners..
No one else can access it...
To post reply
Related Questions Related Questions
Encapsulation Doubt in my code
Encapsulation Vs Abstraction
Encapsulation and Abstraction in c#.net
difference between the code in encapsulation concept.
Latest Forum Questions From The Same Category
Brief explanation with sample examples on oops conects and Access Specifiers in .net?
propeties in c#
Real time example of Multiple Inheritance in C#
Encapsulation Vs Abstraction
Real time example of multiple inheritance
What is function overriding? give me an example
Use of Private Constructors
SingleTon Design Patterns
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more
Quick Links For Forum Categories:
Hall of Fame
Terms of Service
Tell A Friend