0% found this document useful (0 votes)
4 views

forms of inheritance

The document discusses inheritance in Java, defining it as a mechanism to create new classes from existing ones, with the parent class referred to as the super class and the new class as the subclass. Various forms of inheritance are outlined, including specialization, specification, construction, extension, limitation, and combination. The document emphasizes the advantages of inheritance, such as code reusability and the principle of substitutability.

Uploaded by

RamMohan Kanchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
4 views

forms of inheritance

The document discusses inheritance in Java, defining it as a mechanism to create new classes from existing ones, with the parent class referred to as the super class and the new class as the subclass. Various forms of inheritance are outlined, including specialization, specification, construction, extension, limitation, and combination. The document emphasizes the advantages of inheritance, such as code reusability and the principle of substitutability.

Uploaded by

RamMohan Kanchi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 5
Rx WD) 4 Senne © C5 Of ino Aeqoivi Entity Qviving properties 10m one to anther Entity is called 'Mhevitance - IMheritance iSa@ bony ty Create NeW class Prom Exiating Class . Ealating class is Calleq Super Class * : oh rea aay Newey Created Class 1S Called Sub class The main advantage Of inheritance ts code Revsabilit 3 Java inheritance can be implemenkd by ed the. Kewioords extends - il The Felling are Some forms of Inheritance (1). iwheritane for Specraliaation + (9)+ inheritone 40" Specification « (3). inheritance fo" Conariuctiva - (uy). Tnkeritane 70 Exkenpion- (5). Tyhesitone For Umitotion » (6). Tnhentance F01 Combination + A ‘Scanned with CamScanner (1). Specialiaation « - = SESE ni The migsk Comma form OF inhevitance 1S inheritance for Specialigation - —_— © chitd Class is @ Specialised Form (principe of Subatitubabillig hords: of Parenr Class 4 good Example is the Java hierarchy of- Crraphiad Components in the AlWT: Tearta (2) - specigication 8 - oo This iS Another Mosk Common Use OF inheritance - Here tre Supet Class Jusk Specibies Which method Shovtd be availabe bur Coean't give Code - apis ig SuPPOUcd in Tau by Using interfaces and absract metmods * ‘Scanned wih CemScanner OL —_— << — Note! yyy) ‘5 Wile @hout interfaces ° a () Ho 443 Clas Sample. ienplemint, { Public abpriact void onel); public void one) j 4 y J (3). Conatructio? 5 oe = gn Conatwehe?, child class. inherits most OF nay Change te irs. funckionality 10m para , bur ™mo4 ang vrame (0x) Pavamers the ynethod innetied $100 Parent ClaSS- Condryuckio? opten voilares principe & gue sth 1 ture bU ONY ° Examples toriie albour method overriding Coefer paymorohira) . (yu). Extention « - => 43n Inheritance fot exkengivg SubClass adds ned melnls to tne Paienr Class and oes nor rnoatiog (or) aller Ony OF He imeniied Propesns - Sriherivance. for Exrennie hotdS principle F Subaritiha billy © ‘Scanned wih CemScanner Erampe class A class & extends A { { id 1wor Public. void one¢ ) Public Void 1 jp t 5 3 3 Nor Exanpic Programe of Tnhuaitane (S)- Umitation >. ? voile hee * 3h Inhestance &Lor Limitation the Subclass] Child Clad SeHtricks the Unberied be haviour snnevitance fet limitation voilaties Principle of substitutability - The child Class Limits Some Of the behavior of. He Parenr Class Cranpie!= lef ining Queue Class aS subclass Deaucuc” (6). Combination 2 amet ——— " n ah This Hype OR inheritance |S knows muthiple: onreritance + ‘Scanned wih CamScanner DW @ “Song I Aves nor suppor muttiPle anhevitan divecay , 31 Tava muttiple gnheritance Can be achieved b a ; q Using wakerfaces. Concent * 5k is Possible to take A subclass 23 irmp\ementetion class- Se interface AYR Class Helle Class Sample exends Hetto inapremene AY “Were Sample. is the SUR ess of, Bello Class and Torerfoce © implemention Class OF Aga not— voile about tae ‘Scanned with CemScanner

You might also like