Hi Friends...
I have very confusion in abstraction and encapsulation concept ? Please explain in details of abstraction and encapsulation concept with real life example ?
Thanks...
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prime bPosted Jan 29, 2012, 12:09 AM
and keeps both safe from outside interference and misuse. In an object-oriented language, code
and data can be bound together in such a way that a self-contained black box is created. Within
the box are all necessary data and code. When code and data are linked together in this fashion, an
object is created. In other words, an object is the device that supports encapsulation.
Within an object, code, data, or both may be private to that object or public. Private code or
data is known to and accessible by only another part of the object. That is, private code or data
cannot be accessed by a piece of the program that exists outside the object. When code or data
is public, other parts of your program can access it, even though it is defined within an object.
Typically, the public parts of an object are used to provide a controlled interface to the private
elements of the object.
C#'s basic unit of encapsulation is the class. A class defines the form of an object. It
specifies both the data and the code that will operate on that data. C# uses a class specification
to construct objects. Objects are instances of a class. Thus, a class is essentially a set of plans
that specify how to build an object.
The code and data that constitute a class are called members of the class. Specifically,
the data defined by the class is referred to as member variables or instance variables. The
code that operates on that data is referred to as member methods or just methods. "Method"
is C#'s term for a subroutine. If you are familiar with C/C++, it may help to know that what a
C# programmer calls a method, a C/C++ programmer calls a function. Because C# is a direct
descendent of C++, the term "function" is also sometimes used when referring to a C# method.
Taking from the book http://www.amazon.com/3-0-Beginners-Guide-Herbert-Schildt/dp/0071588302/ref=dp_ob_title_bk
Encapsulation is is one of the common traits in C# or OOP in general
When team is working on big projects for example such as Windows 8, so each member of team is working on certain part of Windows 8 and when they done it allows them to combine all the code from each person in the team in to one single code which becomes Windows 8. All it is nothing but wrapping the data and functions into single entity!
Watch that video , he explains it pretty clear
http://www.youtube.com/watch?v=QzX7REqciPY