What are the core concepts of OOPS?
- Class
- Objects and Methods
- Code Reusability Module Concepts
- Inheritance
- Has - A Relationship
- Polymorphism
- Method Overloading
- Method Overriding
- Security Module Concepts
- Abstraction
- Encapsulation
- Data Hiding
- Tightly Coupled Classes
- Composition
- Association
- Aggregation
- A child class inheriting states and behaviors from multiple parent classes is known as multiple inheritance.
- In case of multiple inheritance, suppose class A has two subclasses B and C, and a class D has two super classes B and C.
- If a method present in A is overridden by both B and C but not by D then from which class D will inherit that method B or C? This problem is known as diamond problem.
- Object Oriented Programming languages like Java and C++ follow concepts of OOPS like- Encapsulation, Abstraction, Polymorphism and Inheritance etc.
- Object Based Programming languages follow some features of OOPS but they do not provide support for Polymorphism and Inheritance. Egg. JavaScript, VBScript etc.
- Object Based Programming languages provide support for Objects and you can build objects from constructor.
- These languages also support Encapsulation. These are also known as Prototype-oriented languages.
Can we create an object of abstract class?
- No we cannot create an object of abstract class but we can create a Reference to it.
Is Inheritance Tightly coupled or Loosely coupled?
- Inheritance is tightly coupled since any changes to the Parent class impacts the child class.
- Inheritance is "Is-A" relationship.
- For a loosely coupled architecture we must create a "Has-A" architecture where we create an object of a class in another class.