Click here to Skip to main content
15,923,006 members
Please Sign up or sign in to vote.
1.00/5 (6 votes)
See more:
dear all friend please tell me what is Encapsulation in oops
Posted

Google can find you explanations better than we could give: http://en.wikipedia.org/wiki/Information_hiding#Encapsulation[^] or http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming)[^]

But basically, encapsulation is the "hiding" the implementation of some data / class within another class in order to restrict and control the access to the data. For example, a PileOfBooks class may encapsulate the List<Book> collection that holds the actual books so that the outside world can only directly get at the book on the top of the pile, while being able access any book in the stack itself for other purposes - such is a "Contains" method which says if a specific book is in the Pile.
 
Share this answer
 
Encapsulation is one of the pillars of Object Oriented Programming: see, for instance, its very Wikipedia page[^].
 
Share this answer
 
try this links..


HTML
http://www.tutorialspoint.com/csharp/csharp_encapsulation.htm

http://www.completecsharptutorial.com/basic/encapsulation-abstraction.php

http://www.onlinebuff.com/article_oops-principle-encapsulation-in-c-with-an-example_15.html
 
Share this answer
 
find best all oops concept here
 
Share this answer
 
Encapsulation is one of the four fundamental OOP concepts. The other three are inheritance, polymorphism, and abstraction.

Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. If a field is declared private, it cannot be accessed by anyone outside the class, thereby hiding the fields within the class. For this reason, encapsulation is also referred to as data hiding.

Encapsulation can be described as a protective barrier that prevents the code and data being randomly accessed by other code defined outside the class. Access to the data and code is tightly controlled by an interface.

The main benefit of encapsulation is the ability to modify our implemented code without breaking the code of others who use our code. With this feature Encapsulation gives maintainability, flexibility and extensibility to our code
 
Share this answer
 
Encapsulation is the packing of data and functions into a single component. The features of encapsulation are supported using classes. It allows selective hiding of properties and methods in a class by building an impenetrable wall to protect the code from accidental corruption.

Simple Example is private Variables.

C#
using System;

namespace RectangleApplication
{
    class Rectangle
    {
        //member variables
        private double length;
        private double width;
.....


For More information[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900