Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
$og
%at
'
*ultiple inheritance
A deri+ed class can ha+e more than one "ase class ,a+a does not support it - uses .inter/ace0 instead.
%ircle
Pol gon
Ellipse
S3uare
Rectangle
4exagon
Registration
%all Processing
S*S
7rigination
Page Response
9alue o/ inheritance:
4elps us to "reak so/tware into managea"le pieces Existing classes can "e morphed to design new classes - code reuse Ena"les us to group di//erent t pes o/ o"#ects together and do some action on all o/ them.
$og
%at
%oncepts
Static "inding +s. d namic "inding Pol morphism using +irtual methods A"stract "ase class A"ilit o/ "ase class pointers to point to deri+ed class o"#ects
1?
Add 4uman:
Animal 4uman
$og
%at
%<<
AnimalActions
Animal
4uman
$og
%at
1&
,a+a: Inter/ace
Animal
AnimalActions
1'
6histler
Parrot
4uman
11
Parrot
6histler
4uman
15
%oncepts
Inter/ace
18
%<<
Animal AnimalActions
$og
%at
4uman
1;
,a+a: Inter/ace
Animal
AnimalActions
1=
1>
Re/erences
http://en.wikipedia.org/wiki/Pol morphism!in!o"#ect-oriented!programming Animals : Inheritance coding examples in ,a+a/%<</@ http://en.wikipedia.org/wiki/Inter/ace!A&=,a+aA&> - ,a+a Inter/aces
&?