Bonus Question

What is an abstract class?

In general terms, an abstract class is a class that is intended to be used for inheritance. It cannot be instantiated. An abstract class can consist of both abstract and non-abstract methods.

In C++, an abstract class is a class that contains at least one pure virtual function.

In Java, an abstract class is declared with an abstract keyword.

Example:

C++
class absClass {
public:
    virtual void pvFunc() = 0;
}
Java
abstract class absClass {
    // body
}


In Python, we use ABC (Abstract Base Class) module to create an abstract class.

Must Refer:



30 OOPs Interview Questions and Answers (2024)

Object-Oriented Programming, or OOPs, is a programming paradigm that implements the concept of objects in the program. It aims to provide an easier solution to real-world problems by implementing real-world entities such as inheritance, abstraction, polymorphism, etc. in programming. OOPs concept is widely used in many popular languages like Java, Python, C++, etc.

OOPs is also one of the most important topics for programming interviews. This article contains some top interview questions on the OOPs concept.

Similar Reads

OOPs Interview Questions

1. What is Object Oriented Programming (OOPs)?...

Bonus Question

What is an abstract class?...