Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
POLYMORPHISME

POLYMORPHISME

Ratings:

4.0

(1)
|Views: 49 |Likes:
Published by api-26420184
un cours de revision
un cours de revision

More info:

Published by: api-26420184 on Oct 19, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

03/18/2014

pdf

text

original

Page 1
Le Langage Java
Le polymorphisme
copyright \u00a9Thierry Douchet
Janvier 2006
2
La classe Personne
class Personne
{ private String nom;
private String prenom ;
private int age;
public Personne ()
{ nom ="" ; prenom = "" ; age = 0 ; }
public Personne ( String _nom , String _prenom , int _age )
{ nom = _nom ; prenom = _prenom ; age = _age ; }
public String getNom () { return nom ; }
public void setNom ( String _nom ) { nom = _nom ; }
public void afficher()
{ System.out.println ( nom + " " + prenom + " " + age ); }
public void anniversaire() { age++ ; }
}
copyright \u00a9Thierry Douchet
Janvier 2006
3
La classe Stagiaire
class Stagiaire extends Personne
// h\u00e9ritage en Java -> extends
{
private String cours;
public Stagiaire()
{ cours= "" ; }
public Stagiaire( String _nom , String _prenom , int _age ,String _cours )
{ super ( _nom , _ prenom , _age ); // appel du constructeur de la classe de ba
cours = _cours;
}public String getCours () { return cours ; }
public void setCours ( String _cours ) { cours = _cours ; }
public void afficher ()
{ super.afficher ();
System.out.println ("Cours : cours" + cours );
}
}

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->