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.
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.
In what sense is ambiguity an essential component of object-oriented programming? Think in the context of...
1. How does polymorphism contribute to the design of object-oriented systems? 2. Explain the role of the vptr and vtable in the implementation of virtual functions. 3. What is a pure virtual function and why would you ever use one? 4. What is the purpose of a virtual destructor? 5. Describe a situation where it makes sense for a class to have a destructor, but no constructor.
Many programmers think that object-oriented programming is a superior approach to procedural programming. Others think it adds a level of complexity that is not needed in many scenarios. Find and summarize arguments on both sides of this issue. With which side do you agree? Why? Be thorough and detailed with your answers. Write at least two FULL PARAGRAPHS and be sure to CITE your sources (using MLA or APA format). "Summarize" here means to state in your own words--do not copy and paste the words of others. You must...
If possible, write this code in object oriented programming, if not in object oriented that's okay I can convert it. All in C++ language Generate a list of random numbers using srand and rand, sort the random numbers and put the sorted list into a text file (.txt) using for loop and use stream insertion operator to a text file. Also, put it in a binary file (not using a for loop or stream insertion [use right system caller]). All...
What are constructors? Explain why they are needed in an object-oriented programming language. If inheritance takes place, what is the order in which the parent and child constructors are called? Can a constructor be overloaded? Can a constructor be overridden? Explain when a destructor should be declared as virtual in C+? Explain the use of the access specifiers public, protected and private in C++. Which is the default specifier?
The characteristic of object oriented programming that allows the method in subclass that overrides the same method in the superclass to be correctly called from an instance of that superclass is called A. abstractness B. polymorphism C. data binding D. inheritance
What are the 3 necessary components for a programming language to be considered a Object Oriented programming language? Explain
Purpose: The main goal of this assignment is to practice Object Oriented Programming by creating classes, writing methods, and creating inheritance type relationships. Task: Create a Java project using the IDE Write a program using Object Oriented Programming Plan a program where two classes inherit from a single class and theme it in a way that makes sense. Create a super class with a non-constructor method Create two sub classes with their own non-constructor methods and have them inherit from...
What is object oriented programming? please give introduction, explanation and conclusion.
What is polymorphism in Object-oriented programming? Write down C# code example support the polymorphism
Please reflect what you have learned in this class on the following topics: - Object-Oriented programming - SQL - File - Network WebServices