Tutorialspoint.dev
Welcome To Tutorialspoint.dev
Officially launched 18th May 2019
C C++ C

Default arguments and virtual function

Predict the output of following C++ program. #include <iostream> using namespace std;    class Base { public:     vi...
C C++ C++-Static Keyword

Can static functions be virtual in C++?

In C++, a static member function of a class cannot be virtual. For example, below program gives compilation error. #include<iostream>    us...
C C++ CPP-Functions

Can virtual functions be inlined?

Virtual functions are used to achieve runtime polymorphism or say late binding or dynamic binding. Inline functions are used for efficiency. The whole idea behind th...
C++ C++-Destructors secure-coding

Virtual Destructor

Deleting a derived class object using a pointer to a base class that has a non-virtual destructor results in undefined behavior. To correct this situation, the base ...
C++ CPP

Virtual functions in derived classes

In C++, once a member function is declared as a virtual function in a base class, it becomes virtual in every class derived from that base class. In other words, it i...
C C++ cpp-constructor

Pure virtual destructor in C++

Can a destructor be pure virtual in C++? Yes, it is possible to have pure virtual destructor. Pure virtual destructor are legal in standard C++ and one of the most im...
C++ School Programming cpp-inheritance

Pure Virtual Functions and Abstract Classes in C++

Sometimes implementation of all function cannot be provided in a base class because we don’t know the implementation. Such a class is called abstract class. ...
C C++ C

Advanced C++ Virtual Copy Constructor

In the virtual constructor idiom we have seen the way to construct an object whose type is not determined until runtime. Is it possible to create an object witho...
C C++ C

Advanced C++ Virtual Constructor

Can we make a class constructor virtual in C++ to create polymorphic objects? No. C++ being static typed (the purpose of RTTI is different) language, it is ...
C C++ CPP-Functions

Can virtual functions be private in C++?

In C++, virtual functions can be private and can be overridden by the derived class. For example, the following program compiles and runs fine. #include<i...

Subscribe to Our Newsletter