OOP'S Concepts iOS - Imtiaz211/interviews GitHub Wiki
What is Abstraction?
Hiding complete implementation details from the user is called
abstraction. Due toabstractionusers will feel comfortable while working with the product.
What is the d/w “object based” and “object Oriented” programming language?
- If the programming methodology supports only encapsulation then, it is called object based programming language.
- If the programming methodology supports encapsulation, inheritance and polymorphism then, it is called Object Oriented Programming language. Both support code extendability.
Explain Inheritance?
Inheritanceis an object oriented programming concept. it allows to develop a new class that is reusable and can extend the behaviour that is defined in another class.Multiple inheritanceis an object-oriented concept in which a class can inherit behavior and attributes from more than one parent class.- In Swift a class can conform to
multiple protocols, butinherit from only one class. Value types, such as struct and enum, can conform to multiple protocols only.
Abstract Class?
Abstractclass is a class intended purely for subclassing, one must not instantiate it. Abstract class declares something and has also the implementation for that.
What is polymorphism?
- It enables methods to exhibit different behaviours under different instances. The task of creating a function or an operator that behaves differently in different instances is known as operator overloading which is an implementation of polymorphism.
Operator overloadingis the practice of adding new operators and modifying existing ones to do different things. function overloading is with different signature is called function overloading.
What is Encapsulation?
Encapsulationis anObject-Oriented Programmingconcept that binds together the data and functions that manipulate the data and that keep safe from outside interference and misuse.