+ 2
Hi All.! can you give me simple definitions of Abstraction, polymorphism, encapsulation and inheritance.? for interview.! Thanks;)
3 Respuestas
+ 10
*Abstraction* is a way of thinking that summarizes the essential. Classes and their relationships are a way of expressing abstraction.
*Inheritance* is *the* means to express abstraction in object oriented programming languages.
*Polymorphism* is a technique in object oriented languages to deal with behavioral details in a uniform, abstract way.
*Encapsulation* is a technique in object orientation that tries to ensure state invariants in object instances by preventing unwanted access to the state of an object instance.
These are not the best definitions of the terms. They are short and still leave some thinking to the user but how else would someone deeply understand a definition? :-)
+ 3
just adding on to the other answer
abstraction is a layer on top of code, making functions or classes is a form of abstracting away from machine code.
inheritance is the relationships between classes, where attributes or methods get passed to another related function often to represent a parent-child relationship.
polymorphism is a function, class, or templates' ability to deal with different kinds of inputs
encapsulation is a technique which limits access to protect data
+ 2
encapsulation:- means hiding information of class members against unauthorized programmers or person.
inheritance:- having the knowledge of past programs that has been finished
abstraction:- to provide only the necessary information ..for example :- to deposit a money we need only few things:-1)a/c no. 2) name of a/c holder 3) amount to be deposited and remaining info. like father name,mother name,pin no. etc are not necessary.
polymorphism:- a single face but multiple personality .eg. a person can be detective in private life even though he is actually a doctor in real life
✌