answersLogoWhite

0


Best Answer

No, it is not necessary, but the derived class will be rendered abstract as well. Sometimes that can be desirable. Only derived classes that provide a complete implementation of all inherited pure-virtual methods can actually be instantiated. However, derived classes can also inherit pure-virtual implementations from any intermediate base classes, but not from the least-derived abstract base classes (where the pure-virtual methods originated). Abstract base classes can also provide their own default implementations of their own pure-virtual methods, but they cannot be called implicitly, even from the base class itself. These methods must still be overridden by derived classes, even if an override only needs to explicitly call the base class method.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is it necessary to provide a definition to the pure virtual function in the inherited derived class?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are the limitations of friend function?

Only that they cannot be inherited by derived classes. This is "a good thing". Other than that, a friend function has full access to a class' private and protected members and you cannot limit its scope.


Which base class member functions are not inherited by a derived class?

Derived classes only inherit the protected and public members of their base classes. Private member functions cannot be inherited by a derived class.


Can a derived class make a public base function private true or false?

True. A derived class can make a public base function private. The derived function is private, within the derived class, but public in other contexts.


What is the difference between virtual function and function overriding?

Virtual Functions and Pure Virtual Functions are relevant in the context of class inheritance.Unlike Virtual Functions, Pure Virtual Functions do not require a body. This implies that when a base class defining such a function is inherited, the derived class must implement that function. Furthermore, the base class becomes abstract; meaning you cannot create an instance of the base class even if a body is implemented for the function. You are expected to derive from abstract classes; only the derived classes that implement all the inherited Pure Virtual functions can be instantiated.Here are some examples of Virtual and Pure Virtual function signatures:- Virtual Function: E.g. virtual void myFunction();- Pure Virtual Function: E.g. virtual void myFunction() = 0;


Why are Inheritance super classes fragile?

Superclasses are considered fragile because seemingly safe modifications to a super class, when inherited by the derived classes, may cause the derived classes to malfunction.

Related questions

Why friend functions are not inherited in c plus plus?

Friend functions are not inherited because they are, by definition, friends of the classes in which they are declared. As such, a derived class must explicitly grant permission to a friend function, even when that function is a friend of the base class. Bear in mind that friends are highly-privileged -- so much so that I actively avoid using them wherever it is possible to do so. It may well be part of the language, and is sometimes the only the way to solve a problem, but it breaks the fundamental rules of encapsulation. Allowing a highly-privileged friend function to be inherited without your knowledge is a recipe for disaster -- every derived class from that point on would be exposed to it, rightly or wrongly. Hence you must explicitly declare the friendship, and only where it is deemed necessary.


When the concept of method overriding is necessary?

concept of overriding is very important as due to overriding the derived class can use the function of the base class! when the function has same name and prototype in both the classes(base and derived) then the derived class can use the funtion of base class!


What are the limitations of friend function?

Only that they cannot be inherited by derived classes. This is "a good thing". Other than that, a friend function has full access to a class' private and protected members and you cannot limit its scope.


Which base class member functions are not inherited by a derived class?

Derived classes only inherit the protected and public members of their base classes. Private member functions cannot be inherited by a derived class.


What are the limitations of functionalism?

Only that they cannot be inherited by derived classes. This is "a good thing". Other than that, a friend function has full access to a class' private and protected members and you cannot limit its scope.


Can a derived class make a public base function private true or false?

True. A derived class can make a public base function private. The derived function is private, within the derived class, but public in other contexts.


Definition for fundamental quantities and derived quantities?

the differentiate between fundamental quantity and derived quantity?


What is the difference between virtual function and function overriding?

Virtual Functions and Pure Virtual Functions are relevant in the context of class inheritance.Unlike Virtual Functions, Pure Virtual Functions do not require a body. This implies that when a base class defining such a function is inherited, the derived class must implement that function. Furthermore, the base class becomes abstract; meaning you cannot create an instance of the base class even if a body is implemented for the function. You are expected to derive from abstract classes; only the derived classes that implement all the inherited Pure Virtual functions can be instantiated.Here are some examples of Virtual and Pure Virtual function signatures:- Virtual Function: E.g. virtual void myFunction();- Pure Virtual Function: E.g. virtual void myFunction() = 0;


What is the definition of toponym?

A toponym is a place name, especially one derived from a topographical feature. It can refer to the name of a town, city, or other geographic location.


What does Derived Property mean in maths?

i don't really know to be honest... i know that a derived property follows from a definition; (a definition is a minimum set of conditions needed to describe something)


What is the definition of m in m derived filters?

m in m derived filters refers to its association with the midpoint impedance


What is nuclear energy definition?

energy derived from the atomic nucleus