Play audio slide show -- Keyboard shortcut: 'x'  Lecture overview -- Keyboard shortcut: 'u'  Previous page: Forhinding af redefinition -- Keyboard shortcut: 'p'  Next page: Covarians og contravarians -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  Annotated slide -- Keyboard shortcut: 't'  Alphabetic index  Help page about these notes  Course home  Play sound for this slide -- Keyboard shortcut: 'y'    Nedarvning - slide 37 : 41

Varians af parametre og returværdi under redefinition 

Hvordan kan vi tillade at parametre og returværdi af en metode varierer under redefinition?
 

 

   A aref;
   B bref = new B();
   S sref = new S();

   aref = bref;

   aref.meth(sref);
 

Det er problematisk at overføre et S-objekt som parameter til op i B