Yahoo India Web Search

Search results

  1. Feb 4, 2015 · Consider the below real time example: Encapsulation: As a driver you know how to start the car by pressing the start button and internal details of the starting operations are hidden from you. So the entire starting process is hidden from you otherwise we can tell starting operation is encapsulated from you.

  2. Apr 13, 2009 · Difference between Encapsulation and Abstraction in OOPS. Abstraction and Encapsulation are two important Object Oriented Programming (OOPS) concepts. Encapsulation and Abstraction both are interrelated terms. Real Life Difference Between Encapsulation and Abstraction. Encapsulate means to hide.

  3. Apr 15, 2013 · A good example of Encapsulation is when using Getters and Setters. You assign a value to a private property of an instance of a class (object) through the Setter method (e.g, setName("john") where setName(firstName) is a public method that contains _firstName = firstName where _firstName is a private property).

  4. Encapsulation means self contained. All the objects in Java have a set of data and methods to operate on that data. So the user of any object does not have to worry about the about how the obect is working. This way you hide the information and other complexities. Example: Any Java object is enough to represent an example.

  5. Aug 29, 2012 · Encapsulation is more clearly explained in terms of a black box. The internals can change whenever necessary, but the public interface remains the same. With that said, your code is partially encapsulated, as you have a private int with a public getter and setter (and a private getter, which I see no purpose in, but that's up to you).

  6. Wrapping up data member and method together into a single unit (i.e. Class) is called Encapsulation. Encapsulation is like enclosing in a capsule. That is enclosing the related operations and data related to an object into that object. Encapsulation is like your bag in which you can keep your pen, book etc.

  7. Feb 14, 2014 · As for a real world example, imagine your future self sitting down with some code you wrote and trying to locate where a certain bug occurs. After days of hunting you determine the culprit: A member variable of an instance of your class was modified. And not even by you, but by a fellow member of your team who depended on that variable.

  8. Sep 27, 2013 · Encapsulation is one of the four fundamental OOP concepts.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.

  9. Mar 2, 2013 · Encapsulation: Wrapping code and data together into a single unit. Class is an example of encapsulation, because it wraps the method and property. Abstraction: Hiding internal details and showing functionality only. Abstraction focus on what the object does instead of how it does. It provides generalized view of classes.

  10. Feb 20, 2015 · At the same time, information hiding helps putting encapsulation to good use: if people could access data from the outside, there would be a very high danger to have other coders that write their own (not encapsulated) code to deal with your data, which would at the very least lead to code duplication (i.e., useless efforts) and to inconsistencies if the implementations are not perfectly compatible.

  1. People also search for