answersLogoWhite

0

What is derived class in brief?

Updated: 8/9/2023
User Avatar

Wiki User

10y ago

Best Answer

A derived class is any class that inherits from one or more other classes, known as base classes. The derived class inherits the sum total of all public and protected members of all its base classes, including their base classes. The derived class is a more specialised form of its base classes. Any members of the base classes that are declared virtual can be overridden, such that calling the base class method directly actually invokes the derived class method, thus enabling polymorphic behaviour.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Any class that inherits the public and protected members of one or more classes is said to be a derived class. The classes from which it is derived are known as the base classes. All base classes must include a public or protected default constructor and derived classes must include the definitions of their base classes.

#include "BaseClass.h"

class DerivedClass : public BaseClass

{

public:

DerivedClass(){}

}

#include "BaseClass1.h"

#include "BaseClass2.h"

class MultiDerivedClass : public BaseClass1, public BaseClass2

{

public:

MultiDerivedClass(){}

}

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

A Derived class is one that derives or extends the features of another class.

Ex:

public class Ferrari extends Car {…}

Here Car is the parent class and Ferrari is the derived class

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is derived class in brief?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Give an example of constructor and destructor in derived class?

class superclass { public: superclass() {... } // c'tor public: virtual ~superclass() {... } // d'tor }; // superclass class derived: public superclass { public: derived() : superclass() { ... } // derived c'tor public: virtual ~derived() {... } // derived d'tor }; // derived class


Does the derived class take the memory of base class in inheritance?

Yes, the derived class includes the memory of the base class. The derived class inherits everything in the base class, data and function, and provides additional data and function as needed.


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 a super class in terms of object oriented programming?

A superclass, also referred to as a parent class, is a class what which other classes are derived from. These derived classes are known as either subclasses or child classes.


When a derived class object is deleted which gets deleted first - the base class object or the derived class object?

When there is no further use of derived class obect in execution sequence then It gets deleted. calling of distructor sequence is reverse of constructor calling sequence ,so first derived class obect deleted than base class obect.


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 is multilevel inheritance in C plus plus?

Multi-level inheritance involves at least 3 classes, a, b and c, such that a is derived from b, and b is derived from c. c is therefore the least-derived base class, b is an intermediate base class and a is the most-derived class.


What do you mean by protected derivation of a sub class from base class?

When you derive a class (the sub-class) from a base class using protected access, all public members of the base class become protected members of the derived class, while protected members of the base class will remain protected. Private members are never inherited so they remain private to the base class. By contrast, if you use public inheritance, the public members of the base class remain public to the derived class, while protected members of the base class remain protected in the derived class. If you use private inheritance, both the public and protected members of the base class become private to the derived class. Note that accessibility cannot be increased, only reduced or left the same. That is, a protected member of a base class cannot be inherited as a public member of a derived class -- it can only be declared private or remain protected. Note also that accessibility is viewed from outside of the derived class. That is, all members of a base class other than the private members are inherited by the derived class and are therefore fully accessible to the derived class. But from outside of the derived class, all base class accessibility is determined by the access specified by the type of inheritance.


What is the top NET class that everything is derived from?

It is System.Object class.


Can a c plus plus class be derived from a Java class?

No.


Is it true that a derived class inherits all the members of its base class?

False. A derived class inherits the public and protected members of its base class. Private members of the base class cannot be inherited.


What is inheirtance in java?

It is basically the same as inheritance in other languages. A derived class can inherit from a parent class, meaning that the derived class will have the characteristics (variables, and procedures - called fields, and methods, in this case) of the parent class. It may also have additional characteristics, defined directly in the derived class.