Here is a list of all important OOPs concepts that I always revise before my interviews. I could not find a curated list for OOPs hence I decided to make a list of my own. I hope this helps other students to revise too☺️.
OOPs: A methodology or paradigm to design a program using classes and objects. It simplifies software development and maintenance
Class: A collection of objects is called class. It is a logical entity. Class doesn’t consume any space.
Object: A real-world entity such as a pen, chair, table, computer, etc.
Attribute: These are data stored inside a class or instance and represent the state or quality of the class or instance. In short, attributes store information about the instance
Encapsulation: Binding (or wrapping) code and data together into a single unit are known as encapsulation.
Abstraction: Data abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation
Polymorphism: The word polymorphism means having many forms. It is one of the OOPs features that allow us to perform a single action in different ways.
Inheritance: When one object acquires all the properties and behaviours of a parent object, it is known as inheritance. It provides code reusability
Constructor: A constructor is a special type of subroutine called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables
Default Constructor: A default constructor is a constructor that either has no parameters or if it has parameters, all the parameters have default values
Parametric Constructor: Constructors that can take at least one argument are termed parameterised constructors. When an object is declared in a parameterised constructor, the initial values have to be passed as arguments to the constructor function.
Copy Constructor: Copy constructors define the actions performed by the compiler when copying class objects
Destructor: It is a method that is invoked mechanically just before the memory of the object is released. Its main purpose is to free the resources (memory allocations, open files or sockets, database connections, resource locks, etc.)
Inline Function: Inline function is a function that is expanded in line when it is called. When the inline function is called whole code of the inline function gets inserted or substituted at the point of an inline function call
Virtual Function: A virtual function is a member function that you expect to be redefined in derived classes.
Pure Virtual Function: It is a virtual function that is required to be implemented by a derived class if the derived class is not abstract.
Friend Function: It is a function that is given the same access as methods to private and protected data
Function Overloading: It is a feature of object-oriented programming where two or more functions can have the same name but different parameters. When a function name is overloaded with different jobs it is called Function Overloading.
Operator Overloading: It is polymorphism in which an operator is overloaded to give user-defined meaning to it. For example, the ‘+’ operator can be overloaded to perform addition on various data types, like for Integer, String(concatenation), etc.
Operators that cannot be overloaded: Scope Resolution(::), Member Selection(.), Member selection through a pointer to function(.*)
Method Overriding: Overriding is done so that a child class can give its own implementation to a method that is already provided by the parent class
Abstract Class: Abstract classes and methods are when the parent class has a named method but needs its child class(es) to fill out the tasks. An abstract class is a class that contains at least one abstract method. An abstract method is a method that is declared but not implemented in the code.
Finalise Method: The finalize() method of Object class is a method that the Garbage Collector always calls just before the deletion/destroying the object which is eligible for Garbage Collection, so as to perform clean-up activity
Ternary Operator: The ternary operator is an operator that takes three arguments. The first argument is a comparison argument, the second is the result of a true comparison, and the third is the result of a false comparison
Call by value: In call by value method, the value of the actual parameters is copied into the formal parameters. In other words, we can say that the value of the variable is used in the function call in the call by value method.
Call by Reference: In call by reference, the address of the variable is passed into the function call as the actual parameter. The value of the actual parameters can be modified by changing the formal parameters since the address of the actual parameters is passed.
Tokens: A token is the smallest element of a C++ program that is meaningful to the compiler. The C++ parser recognises these kinds of tokens: Keywords. Identifiers. Numeric, Boolean, and Pointer Literals
Super keyword: a reference variable that is used to refer to immediate parent class object. Whenever you create the instance of a subclass, an instance of parent class is created implicitly which is referred to super reference variable
Interface: An interface is a programming structure/syntax that allows the computer to enforce certain properties on an object
Static Binding: The binding which can be resolved at compile time by the compiler is known as static or early binding. Binding of all the static, private, and final methods is done at compile-time.
Dynamic Binding: Dynamic binding is determining the method to invoke at runtime instead of at compile time. Dynamic binding is also referred to as late binding
Access Modifiers: These are keywords in object-oriented languages that set the accessibility of classes, methods, and other members. Access modifiers are a specific part of programming language syntax used to facilitate the encapsulation of components
Sealed Modifiers: When applied to a class, the sealed modifier prevents other classes from inheriting from it.
New keyword: It is used to create an instance of the class. In other words, it instantiates a class by allocating memory for a new object and returning a reference to that memory. We can also use the new keyword to create the array object.
Override keyword: The override keyword is used to extend or modify a virtual/abstract method, property, indexer, or event of base class into a derived class
Base Class: A base class is a class in Object-Oriented Programming language, from which other classes are derived
Sub Class: The subclass inherits state and behaviour in the form of variables and methods from its superclass. The subclass can just use the items inherited from its superclass as is, or the subclass can modify or override it.
Super Class: A class from which other classes inherit code is called a superclass
Abstract Class: An abstract class is a template definition of methods and variables of a class (category of objects) that contains one or more abstracted methods
Abstract Method: Abstract Method is a method that has just the method definition but does not contain implementation. A method without a body is known as an Abstract Method.
Interface: Interfaces specify what a class must do and not how.
Self: It represents the instance of the class. It works as a reference to the object. Python uses the self parameter to refer to instance attributes and methods of the class.
init constructor: In Python, the init() method is called the constructor and is always called when an object is created.
Single Level Inheritance: Single inheritance enables a derived class to inherit properties and behaviour from a single parent class
Multi-Level Inheritance: In Multilevel Inheritance, one class can inherit from a derived class. Hence, the derived class becomes the base class for the new class.
Multiple Level Inheritance: Multiple level inheritance allows an object to inherit many different method signatures with the caveat that the inheriting object must implement those inherited methods.
Method Resolution Order(MRO): MRO is a concept used in inheritance. It is the order in which a method is searched for in a classes hierarchy and is especially useful in Python because Python supports multiple inheritance
Duck Typing: Duck Typing is a type system used in dynamic languages where the type or the class of an object is less important than the method it defines. Using Duck Typing, we do not check types at all. Instead, we check for the presence of a given method or attribute
Types of Abstraction: Data Abstraction and Process Abstraction
Data Abstraction: When the object data is not visible to the outer world, it creates data abstraction. If needed, access to the Objects’ data is provided through some methods.
Process Abstraction: We don’t need to provide details about all the functions of an object. When we hide the internal implementation of the different functions involved in a user operation, it creates process abstraction.
52.Shallow copy: In shallow copy, an object is created by simply copying the data of all variables of the original object. The shallow copy constructor is used when class is not dealing with any dynamically allocated memory.
53.Deep Copy: In Deep copy, an object is created by copying data of all variables and it also allocates similar memory resources with the same value to the object. In order to perform Deep copy, we need to explicitly define the copy constructor and assign dynamic memory as well if required.
Thank you for reading!🙏