Sunday, 2024-05-05, 3:33 AM
Fireflies
Welcome Guest | RSS
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » student circle » vtu » test (pata nahi)
test
firefliesDate: Wednesday, 2011-08-31, 11:58 PM | Message # 1
Lieutenant colonel
Group: Administrators
Messages: 100
Reputation: 0
Status: Offline
What is "abstraction" and "encapsulation" in C++?
please explain it with the help of program with detal......

i will very very thankful to u if u explain in"hindi" language...

abstraction:- jab hum background details na dikha kar bus upar upar ke view dikhte h use abstrctn kehte h... jaise computer h,, uska hume keyboard, monitor, mouse yahi sab dikhta h... hume andar to nahi pata na ki kaise wiring ki gayi h... isko absrtan kehte h...

encapsulation:- jab data n functions ko combine karte h usko ecap kehte h... matlab jis cheez pay kaam karna n uspe kya kaam karna h dono ek he jagah ek saath mentioned ho to usse encapsulation kehte h... jaise c++ may classes may hota h...

ok in c++ which is a object oriented language we have two concepts i.e abstraction and encapsulation.
EX:
class student
{
public int roll_no;
private char name;
public void read();
};
here you will see "class" student contains both data members like roll_no and name and member function read().because both data members and fuctions are included in a single class ,this supports encapsulation and when other classes try to use this class student ,they will not be permitted to see the complete inside of class this feature is called abstraction.

The concept of abstraction relates to the idea of hiding data that are not needed for presentation. The main idea behind data abstraction is to give a clear separation between properties of data type and the associated implementation details. This separation is achieved in order that the properties of the abstract data type are visible to the user interface and the implementation details are hidden. Thus, abstraction forms the basic platform for the creation of user-defined data types called objects. Data abstraction is the process of refining data to its essential form. An Abstract Data Type is defined as a data type that is defined in terms of the operations that it supports and not in terms of its structure or implementation.

Encapsulation is the process of combining data and functions into a single unit called class. Using the method of encapsulation, the programmer cannot directly access the data. Data is only accessible through the functions present inside the class. Data encapsulation led to the important concept of data hiding. Data hiding is the implementation details of a class that are hidden from the user. The concept of restricted access led programmers to write specialized functions or methods for performing the operations on hidden members of the class. Attention must be paid to ensure that the class is designed properly.
=====SM=====
 
firefliesDate: Wednesday, 2011-08-31, 11:58 PM | Message # 2
Lieutenant colonel
Group: Administrators
Messages: 100
Reputation: 0
Status: Offline
"Encapsulation is the process of compartmentalizing the elements of an abstraction that constitute its structure and behavior; encapsulation serves to separate the contractual interface of an abstraction and its implementation."
Grady Booch - Object Orientated Design
 
Forum » student circle » vtu » test (pata nahi)
  • Page 1 of 1
  • 1
Search:

Copyright MyCorp © 2024Website builderuCoz