100 C++ Interview Questions
1. What is OOP?
OOP stands for Object Oriented Programming. OOP is a programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple reusable pieces of code blueprints (usually called classes) which are used to create individual instances of objects.
C is a procedural a language and yet C++ is an Object Oriented language because it has classes and can take advantage of polymorphism.
2. What is a Class?
Class is a blue print which reflects the entity’s attributes and actions. Technically defining a class is designing a user defined data type.
Here is a simple example class in C++.
class Window {public:
Window();
~Window();};
3. What is an Object?
An instance of a class is called an object
You can create a Window object like this:
Window window;
That is an instance of the Window class, ie, a Window object.
4. List the types of inheritance supported in C++
Single Inheritance — the derived class inherits only one base class. It allows reusability of features inherited from the base class also called the parent class or superclass.