Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2018 Fall CIS200 - Programming Project 4 Release date: November 28, 2018 Due date: December 10, 2018 Dynamic binding (i.e., polymorphism) is one corner stone

image text in transcribed

2018 Fall CIS200 - Programming Project 4 Release date: November 28, 2018 Due date: December 10, 2018 Dynamic binding (i.e., polymorphism) is one corner stone of the object-oriented programming. In C++, we rely on virtual functions and pointers to a base class and its derived classes to implement the polymorphism. Question 1 (30 points) Given the following code int main t class Base t public: void F(O virtual void GO0 virtual void HO virtual void IO D PD-new D Base pB pD; pE new E; // 1ine 1 // line 2 /I line 3 /I line 4 li pB->F pB->GO pB->HO class D:public Base public: virtual void FO void G0 void HO virtual void JO pD->F pD-GO pD->IO pD->JO /1 1ine 5 /I line 6 /I line 7 // 1ine 8 li class E pub1ic D I public: void FO void G0 /I line 9 /I line 10 // line 11 // line 12 li pB-G pB-I pD->FO // line 13 // line 14 pD->Jo // line 15 /I line 16 pE-F pE_ () ; Execute the above code and report the results at each line of the main). By using the knowledge of polymorphism, explain why the result of each line should be what it is

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions