Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

18. Using the concept of pure virtual function write a program with following specifiction a) Create two classes A and B b) Class A has

image text in transcribed
18. Using the concept of pure virtual function write a program with following specifiction a) Create two classes A and B b) Class A has public access modifier and function called show which is pure virtual and displays "Base Class" c) class B inherits class A also has public access modifier and function show which is virtual and displays "Derived class" d) Create pointer object of class A and simple object of class B. Class A pointer object will point to class B object finally display show function of derived class Description In C++ Run time polymorphism can be achieve by using virtual function. Virtual Function is a function in base class, which is override in the derived class, and which tells the compiler to perform Late Binding on this function. In Late Binding function call is resolved at runtime. Hence, now compiler determines the type of object at runtime, and then binds the function call. Late Binding is also called Dynamic Binding or Runtime Binding. Virtual Keyword is used to make a member function of the base class Virtual

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Datalog Engines In Databases

Authors: Bas Ketsman ,Paraschos Koutris

1st Edition

1638280428, 978-1638280422

More Books

Students also viewed these Databases questions

Question

design a simple performance appraisal system

Answered: 1 week ago