What is ambiguity and function overriding? How they can be resolved? Explain each of them with suitable example.

This blog post is the second method of resolving the function overriding problem.

First method can be found here-:

http://www.scitechtop.com/1what-is-ambiguity-and-function-overriding-how-they-can-be-resolved-explain-each-of-them-with-suitable-example/

Accessing overridden members of a base class by the help of derived class object

How/Clue to write this program-:

We will need to make a derived class object.

(the basic difference is that in the previous way, we brought the whole base function to derived as base::input…but now we will use only when we want the value(while displaying..the extra difference is in the int main() function is the extra D.Base::input().)

Below is the source code-:

 

 

Output-:

enter the value to n of a base class9

enter value of n of a derived class 8

the value is-17

again, i want you to remember this thing.

(the basic difference is that in the previous way, we brought the whole base function to derived as base::input…but now we will use only when we want the value(while displaying..the extra difference is in the int main() function is the extra D.Base::input().)

(nowadays, i am writing shorter blog posts because i think these are better than longer blog posts for user attention since you will be coming here to search about 1 thing daily.)

Leave a Comment

Your email address will not be published. Required fields are marked *

Do NOT follow this link or you will be banned from the site! Scroll to Top