Binding of Virtual Functions

Understand why early binding with virtual functions is not possible.

We'll cover the following

Problem

Write a program that illustrates that a virtual function cannot be early bound.

Sample runs

Here’s what you should see when you run the program.

Enter 1 for Shape, 2 for Circle: 1
In Shape class's draw

Enter 1 for Shape, 2 for Circle: 2
In Circle class's draw

Coding solution

Here is a solution to the problem above.

Get hands-on with 1400+ tech skills courses.