Computer Science, asked by marky007, 4 months ago

What are the points noted while deriving a new class?​

Answers

Answered by vaisheltacion
4

Answer:

Derived Class: A class that is created from an existing class. The derived class inherits all members and member functions of a base class. The derived class can have more functionality with respect to the Base class and can easily access the Base class. A Derived class is also called a child class or subclass.

Answered by moossaamjad760
1

Answer:

Points to Remember:

• The mechanism of deriving new class from an existing class is called inheritance.

• The main advantage of Inheritance is it supports reusability of code.

• The derived class inherits all the properties of the base class. It is a power packed class, as it can add additional attributes and methods and thus enhance its functionality.

• The various types of Inheritance are Single inheritance, multiple inheritance, hierarchical inheritance and hybrid inheritance

• When a derived class inherits only from one base class, it isknown as single inheritance

• When a derived class inherits from multiple base classes itis known as multiple inheritance

• When a class is derived from a class which is a derived class itself – then this is referred to as multilevel inheritance. The transitive nature of inheritance is reflected by this form of inheritance.

• When more than one derived classes are created from a single base class , it is known as Hierarchical inheritance.

• When there is a combination of more than one type of inheritance, it is known as hybrid inheritance.

• In multiple inheritance, the base classes are constructed in the order in which they appear in the declaration of the derived class.

• A sub-class can derive itself publicly, privately or protectedly.

• The private member of a class cannot be inherited .

• In publicly derived class,the public members of the base class remain public and protected members of base class remain protected in derived class.

• In privately derived class, the public and the protected members of the base class become protected in derived class

• In publicly derived class, the public members of the base class remain public

• and protected members of base class remain protected in derived class.

• When class is derived in protected mode, the public and protected members of base class become protected in derived class.

• constructors and destructors of the base class are not inherited but during the creation of an object for derived class the constructors of base class will automatically invoked.

• The destructors are invoked in reverse order .The destructors of the derived classes are invoked first and then the base class.

• size of derived class object=size of all base class data members + size of all data members in derived class

• overriding of the members are resolved by using :: Scope resolution operator.

• this pointer used to refer the current objects members

Similar questions