What is encapsulation?

Answers were Sorted based on User's Feedback



What is encapsulation?..

Answer / abalonesoft

Preventing unauthorized access to some piece of information
or functionality.

The key money-saving insight is to separate the volatile
part of some chunk of software from the stable part.
Encapsulation puts a firewall around the chunk, which
prevents other chunks from accessing the volatile parts;
other chunks can only access the stable parts. This prevents
the other chunks from breaking if (when!) the volatile parts
are changed. In context of OO software, a "chunk" is
normally a class or a tight group of classes.

The "volatile parts" are the implementation details. If the
chunk is a single class, the volatile part is normally
encapsulated using the private and/or protected keywords. If
the chunk is a tight group of classes, encapsulation can be
used to deny access to entire classes in that group.
Inheritance can also be used as a form of encapsulation.

The "stable parts" are the interfaces. A good interface
provides a simplified view in the vocabulary of a user, and
is designed from the outside-in (here a "user" means another
developer, not the end-user who buys the completed
application). If the chunk is a single class, the interface
is simply the class's public member functions and friend
functions. If the chunk is a tight group of classes, the
interface can include several of the classes in the chunk.

Designing a clean interface and separating that interface
from its implementation merely allows users to use the
interface. But encapsulating (putting "in a capsule") the
implementation forces users to use the interface.

Is This Answer Correct ?    2 Yes 0 No

What is encapsulation?..

Answer / srinidhi

integrate a related data to form a single unit this is
encapsulation this is possible by using structures

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

how to create duplicate link list using C???

0 Answers  


What is the difference between typeof(foo) and myFoo.GetType()?

2 Answers   Synergy,


Write a program to find minimum between three no.s whithout using comparison operator.

4 Answers   IBM,


palindrome for strings and numbers----Can anybody do the prog?

6 Answers   CTS, TCS, Vipro Lifescience Pvt,


Why we use conio h in c?

0 Answers  






discuss the steps needed to get a program from source code to executable in a system?

1 Answers  


which is the best site or book for learning C...and i need the content for C..how to get the good programming skills....? can plz suggest me....

2 Answers  


What is floating point exception error? And what are different types of errors occur during compile time and run time? why they occur?

1 Answers  


What is new line escape sequence?

0 Answers  


Explain how do you view the path?

0 Answers  


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

0 Answers  


write a program in c to read array check element is present or not?

1 Answers  


Categories