Inheritance in Hindi – इनहेरिटेंस क्या है और इसके प्रकार

हेल्लो दोस्तों! आज मैं आपको बहुत ही आसान भाषा में Inheritance in Hindi (इनहेरिटेंस क्या है और इसके प्रकार) के बारें में बताऊंगा और इसके syntax को भी देखेंगे तो चलिए शुरू करते हैं:-

Inheritance in Hindi

inheritance एक ऐसा mechanism है जिससे एक old class से new class create किया जाता है। इस के द्वारा old class की properties को new class में प्रयोग किया जा सकता है। old class की properties को new class में प्रयोग करने के लिए old class को inherit करना होता है। और class को inherit करने के लिए derivation public , private और protected का प्रयोग किया जाता है।

इनहेरिटेंस में old class को base class या parent class या super class कहा जाता है , जिस class की property ली जाती है। और new class को child class या derived class या sub class कहा जाता है , जिस class के द्वारा property ली जाती है।

Types of inheritance in Hindi

यहाँ पांच प्रकार के इनहेरिटेंस है –

  1. Single
  2. Multiple
  3. Multilevel
  4. Hierarchical
  5. Hybrid
  1. Single inheritance in Hindi

जब किसी एक class को किसी दुसरे class द्वारा inherit किया जाता है तो उस इनहेरिटेंस को single inheritance कहते है। इसमें एक class की property को दुसरे class द्वारा लिया जाता है। इस में केवल एक super class और एक sub class होता है।

Single inheritance

Syntax :- class A

{

};

Class B : public A

{

};

  1. Multiple inheritance in Hindi

जब एक से अधिक classes को एक class द्वारा inherit किया जाता है उस इनहेरिटेंस को multiple inheritance कहते है। इसमें एक से अधिक class की property को एक class द्वारा inherit किया जाता है। इस में एक से अधिक super class और एक sub class होते है.
जावा मल्टीप्ल इनहेरिटेंस को support नहीं करती है.

Multiple inheritance in hindi

Syntax :- Class A

{

};

Class B

{

};

Class C : public A , public B

{

};

  1. Multilevel inheritance in Hindi

जब एक से अधिक class एक level में एक दूसरे को inherit करते है तो उस इनहेरिटेंस को multilevel inheritance कहते है। इसमें एक class किसी दुसरे class को inherit करता है और वह class जो class को inherit करता है वह sub class बन जाता है और उसी sub class को दुसरे class द्वारा inherit किया जाता है। इसी प्रकार सभी class एक दुसरे को inherit करते है।

Multilevel inheritance in hindi

Syntax:- Class A

{

};

Class B : public A

{

};

Class C : public B

{

};

  1. Hierarchical inheritance in Hindi

जब एक base class को एक से अधिक sub class द्वारा inherit किया जाता है तो उस इनहेरिटेंस को hierarchical inheritance कहते है। इसमें एक class की property को एक से अधिक class द्वारा लिया जाता है। hierarchical इनहेरिटेंस में एक base class और एक से अधिक sub class होते है। यह multiple इनहेरिटेंस के विपरीत होता है।

Hierarchical inheritance in hindi

Syntax:- Class A

{

};

Class B : public A

{

};

Class C : public A

{

};

Class D : public A

{

};

  1. Hybrid inheritance in Hindi

जब हम किसी दो प्रकार के इनहेरिटेंस को अपने program में mix करते है तो उसे hybrid इनहेरिटेंस कहते है। यह इनहेरिटेंस एक से अधिक इनहेरिटेंस का combination होता है। अर्थात् यह दो या दो से अधिक इनहेरिटेंस से मिलकर बना होता है.

Hybrid inheritance in hindi
image

Syntax :- Class A

{

};

Class B : public A

{

};

Class C

{

};

Class D : public B , public C

{

};

इसे भी पढ़ें:- OOPS के concepts क्या क्या है?
OSI model क्या है?
C और c++ में क्या अंतर है?

निवेदन:- अगर आपके लिए यह उपयोगी रहा हो तो नीचे कमेंट करके बताइए और इसे अपने classmates के साथ अवश्य share करें.

22 thoughts on “Inheritance in Hindi – इनहेरिटेंस क्या है और इसके प्रकार”

  1. Apki site me explanation bahut achhi hai but es inheritance me lecture me mujhe clear nhi ho pa rha Java ka inheritance search Karne pe v yahi aata h

    Reply
  2. thamku so much sir mai G.P.Dwarahat (almora) se polytechnic krta hu sir
    apse ak request h sir “apne uttrakhand polytechnic ka slaybss diya h to sir mai khna chahta hu ki ap iske all topic k link slyabss mai hi de taki hme or jyada serch krna na pde sir apne koi koi link diye h but all topic link ni diye h to sir plase ap chapter k topic k link vhi pe dede taki hme pdai mai asani ho or hm only slaybss open kr hi sare topic lern kre “thanku so much sir

    Reply

Leave a Comment