OOP Concepts Flashcards
What is a Class?
A class is a blueprint or template for creating objects. It defines the properties (attributes) and behaviors (methods) that objects of the class will have.
What is an Object?
An object is an instance of a class. It represents a real-world entity and has state (attributes) and behavior (methods) as defined by its class.
What is Inheritance?
Inheritance allows a class (subclass or derived class) to inherit properties and behaviors from another class (superclass or base class).
What is Encapsulation?
Encapsulation is the bundling of data (attributes) and methods that operate on the data within a single unit, i.e., a class. It hides the internal state of an object and restricts access to certain components.
What is Polymorphism?
Polymorphism allows objects of different classes to be treated as objects of a common base class.
What is Abstraction?
Abstraction is the process of simplifying complex systems by modeling classes based on essential characteristics and ignoring non-essential details.
What is Method Overloading?
In a class, multiple methods can have the same name but different parameter lists. This is known as method overloading.
What is Method Overriding?
Inheritance allows a subclass to provide a specific implementation for a method that is already defined in its superclass.
What is Association?
Relationship between two classes where one refers to another
What is Aggregation?
Type of association where one class is composed of another, but can exist independently
What is Composition?
Stronger form of aggregation where one class ownes another class and has responsibility over it.
Owned class dependant on it.
What is Interface?
Collection of abstract methods. Classes that use an interface must provide concrete implementations for all the methods defined
What is an Abstract Class?
A class that cannot be instantiated on its own