answersLogoWhite

0


Best Answer

Encapsulation conceals the functional details of a class from objects that send messages to it.

For example, the Dog class has a bark() method. The code for the bark() method defines exactly how a bark happens (e.g., by inhale() and then exhale(), at a particular pitch and volume). Timmy, Lassie's friend, however, does not need to know exactly how she barks. Encapsulation is achieved by specifying which classes may use the members of an object. The result is that each object exposes to any class a certain interface - those members accessible to that class. The reason for encapsulation is to prevent clients of an interface from depending on those parts of the implementation that are likely to change in future, thereby allowing those changes to be made more easily, that is, without changes to clients. For example, an interface can ensure that puppies can only be added to an object of the class Dog by code in that class. Members are often specified as public, protected or private, determining whether they are available to all classes, sub-classes or only the defining class. Some languages go further: Java uses the default access modifier to restrict access also to classes in the same package, C# and VB.NET reserve some members to classes in the same assembly using keywords internal (C#) or Friend (VB.NET), and Eiffel and C++ allow one to specify which classes may access any member.

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

Encapsulation is the term used to describe the packaging of data and the functions that operate upon that data into a single component. The functions can be used to provide an interface to the data, such that the data can be manipulated in a controlled manner. In object oriented programming, this is achieved through classes instantiated as objects. Each object has its own discrete set of data and the class determines how that data may be manipulated. Classes typically encapsulate an invariant that must hold from the point of creation to the point of destruction. Limiting exposure of the object's data through a controlled public interface ensures that the invariant holds true throughout the object's life cycle without the need to constantly test the invariant.

For example, a string has an invariant in that it holds a null-terminated character array with a minimum size of 1 character (for the null terminator). The string class ensures that the array member remains valid throughout the life cycle of any instance of the class. Similarly, a vector has an invariant in that it holds a dynamic array with size and reserve, such that the total of the size and reserve members is equal to the length of the memory currently allocated to the array member.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

when you pack the code and the data part in your program so that no one outside that class can change it ,It is a data hiding .For ex. Suppose you have a variable called "i " in your program if you provide public as a access modifier outside environment can change it.So we give it a modifier called "private" and provide getter() and setter() methods by this way outside environment can call these methods but no one can change it ..

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

Encapsulation is an object-oriented technique that helps restrict access to the protected members of a data structure. It does this by only exposing the structure through a generic public interface, whereby anything can use the interface without "harming" the structure.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Encapsulation is an important concept when it comes to Object Orientation programming. This is because encapsulation restricts the access to certain components. Also, it facilitates data.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is meant by the term encapsulation as it is used in Object Oriented Analysis?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Give 6 characterstics of object oriented programming?

Actually these characterstics may differ from books to books. This is in general: #Data abstraction #Data Encapsulation #Inheritance #Polymorphism #Dynamic Linking #Static Binding Some books consider Objects & Classes also as one among these characteristics.


What is meant by inheritance?

In computer programming, inheritance means to derive a new object from an existing object, such that the new object inherits all the properties of the existing object. In object oriented programming, derived classes inherit the public and protected members of their base classes. This allows new classes to be created from existing classes, without the need to duplicate large chunks of code in the existing class. The new class can augment the inherited code to provide more specific behaviour.


What is the difference between traditional and object orientation?

A traditional approach, also known as structured system development, includes many variations which aim to develop information using structured and modular programming. On the other hand, an object oriented approach looks at the information system as a collection of objects that work together to accomplish a task.


What is meant by transient analysis?

it is the response of a system with respect to the input as a function of time


What is meant by instancing a class?

The class can be considered a template to create objects. When you create an object, you create it on the basis of the specified class - the object is an instance of the class, and the act of creating the object is also known as "instantiating" the class.

Related questions

Give 6 characterstics of object oriented programming?

Actually these characterstics may differ from books to books. This is in general: #Data abstraction #Data Encapsulation #Inheritance #Polymorphism #Dynamic Linking #Static Binding Some books consider Objects & Classes also as one among these characteristics.


Why c is not support of object oriented?

1. C was meant to be simple. 2. C was developped before the OOP


What is meant by method in c?

Object oriented programming is to construct a software as interactions between objects. The interaction between objects are through the means of sending messages, or by invoking methods.


What are the reasons for rise of constructor concept in c?

Not sure what you mean by this. C is a not an object-oriented programming (OOP) language, and therefore has no constructor concept. You probably meant C++ but, even so, there is no "rise of constructor concept". Constructors are fundamental to OOP -- they allow you to initialise an object at the point of instantiation.


What is meant by inheritance in c plus plus language?

Inheritance in C++ and in other Object Oriented languages is the creation of a class that incorporates a different class. The child (or derived) class "inherits" all of the elements (attributes and methods) of the parent (or base) class. Depending on the design of the base class, the derived class can use methods and attributes of the base class as if they were its own. Typically, however, attributes of the base class are private to the base class and inaccessible to the derived class so as to maintain class hierarchy and data encapsulation.


What is meant by a multiplexed address and data bus?

[object Object]


What is meant by the mass of an object?

It's essentially how much of the object there is.


What is meant by cocoa in objective c?

COCOA- an object-oriented programming API for Mac OS XCocoa is object oriented programming environments comprising of an integrated editor/compiler/interface builder and a set of frameworks (dynamically linked libraries) which store almost all of the typical objects (and their methods) you might want in an application. As well as Objective-C, Cocoa programs can also be written in Java, even AppleScript, perl or python.


What is a literary analysis of the US Constitution?

it is what u meant by your self.


What is meant by SAS how its useful?

Is a statistical analysis software, and used for ...


What is MICSAW analysis?

There's no such thing as MICSAW analysis, perhaps you meant MOSCOW?Must HaveShould HaveCould HaveWant to Have


What is meant by an object has mass 6000 gm?

an object weighs 6000 gm