Question

In what sense is ambiguity an essential component of object-oriented programming? Think in the context of...

In what sense is ambiguity an essential component of object-oriented programming? Think in the context of virtual functions, pure virtual functions, and dynamic binding.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:-

what sense is ambiguity an essential component of object-oriented programming? :-

Ambiguity : A situation in which something has more than one possible meaning and may therefore cause confusion.

Now, In case of multiple inheritance, a single class is derived from two or more parent (base) classes. So, there may be a possibility that two or more parents have a member function with the same name. If the object of derived class needs to access one of the same named member function from the base class, then it results in ambiguity. The compiler is confused as method of which base class method to invoke on executing the call statement.

That is when you have a derived class, and a base class, that both have members with the same name. If you attempt to access that “name”, in the derived class, it is ambiguous if you are referring to the name in the derived class, or the base class. You can address this by either changing the name, or specifically referring to the class when addressing the member.

I would also call a lot of operator overloading ambiguous as well. However, that is better suited to a different question. ;)

on the contxt of

virtual functions:-

In object-oriented programming, in languages such as C++, and Object Pascal, a virtual function or virtual method is an inheritable and overridable function or method for which dynamic dispatch is facilitated. This concept is an important part of the polymorphism portion of object-oriented programming

pure virtual functions:-

A pure virtual function or pure virtual method is avirtual function that is required to be implemented by a derived class if the derived class is not abstract. Classes containing pure virtual methods are termed "abstract" and they cannot be instantiated directly

Dynamic binding

Dynamic binding also called dynamic dispatch is the process of linking procedure call to a specific sequence of code (method) at run-time. It means that the code to be executed for a specific procedure call is not known until run-time. Dynamic binding is also known as late binding or run-time binding.

Add a comment
Know the answer?
Add Answer to:
In what sense is ambiguity an essential component of object-oriented programming? Think in the context of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT