हिंदी

What is inheritance? Explain with an example.

Advertisements
Advertisements

प्रश्न

What is inheritance? Explain with an example.

स्पष्ट कीजिए
Advertisements

उत्तर

Inheritance is the process of creating a new class, called the derived class, from an existing class, called the base class. The derived class can use the data members and methods of the base class and may also add its own features.

Example: Mobile_phone can be a base class and i_phone can be a derived class. An iPhone has all common features of a mobile phone, such as model, colour and price, along with its own special features.

This represents an “is-a-kind-of” relationship: an iPhone is a kind of mobile phone.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 2: Concept of Object Oriented Programming - EXCERCISE [पृष्ठ ३७]

APPEARS IN

सीबीएसई Computer Science with Python [English] Class 12
अध्याय 2 Concept of Object Oriented Programming
EXCERCISE | Q 4. | पृष्ठ ३७
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×