Question:
Define abstraction,encapsulation,inheritance:with example.
Answer:
Abstraction- In OOPS All the Internal detail of functionality is hided from the user this is known as Abstraction. i.e User don't have any knowledge of logic but he/she give the input and get output. e.g. A Car driver doesn't know what internally happen when he press accelerator what he know is the car speed is increase.
Encapsulation- Class variables and functions wrapped into a single entity, called class. this is called encapsulation. e.g. A Car is Entity which have Accelerator, Stearing etc. as a variable and Acceleration is a function that encapsulated into a car. inheritance: When we want to use the functionality of a class to be use in other class we use inheritance. Source: CoolInterview.com
Answered by: Pankaj Mathur | Date: 1/27/2008
| Contact Pankaj Mathur
HIDING DETAILS IS ABSTRACTION BINDING OF DATAS IS ENCAPSULATION DERIVATION OF BASE CLASS FROM DERIVED CLASS IS INHERITANCE Source: CoolInterview.com
Answered by: TMYT | Date: 2/20/2008
| Contact TMYT
Abstraction: Hiding of non-essential data is called abstraction
Encapsulation: Binding of data and Behavior i.e functionlality of an object with in a controlled and secured manner
Inheritance: The process of equiring the existing functionality of a parent and with new added features and functionlaity of child class object
Eg: A Caluculator is a collection of Add, Subtract methods where as a scientifice caculator is extened form of calculator with sin and cos operations Source: CoolInterview.com
Answered by: Nageswara Rao | Date: 8/13/2009
| Contact Nageswara Rao
Abstraction- wrapping up of data in to single unit is known as abstraction all the functions and main methods should be declared in a class. eg:-A Car driver doesn't know what internally happen when he press accelerator what he know is the car speed is increase.
Encapsulation:- act of representing essential features with out any background details.
e.g. A Car is Entity which have Accelerator, Stearing etc. as a variable and Acceleration is a function that encapsulated into a car.
Inheritance:- acquiring the properties of one class to other class. i.e parent class to child class e.g. all the property's of parents can be consume by child. but property of child can not be consumed by parent Source: CoolInterview.com
Answered by: sravan kumar | Date: 8/18/2009
| Contact sravan kumar
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|