Created
November 14, 2017 13:35
-
-
Save jewom/7b2f60412f072f1846a60f910e2b25c7 to your computer and use it in GitHub Desktop.
Heritages en Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employe { | |
private String nom; | |
private int salaire; | |
Employe(String nom, int salaire) { | |
this.nom = nom; | |
this.salaire = salaire; | |
} | |
public String getNom() { | |
return nom; | |
} | |
public void setNom(String nom) { | |
this.nom = nom; | |
} | |
public int getSalaire() { | |
return salaire; | |
} | |
public void setSalaire(int salaire) { | |
this.salaire = salaire; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Main { | |
public static void main(String[] args) { | |
Patron jaques_hubert = new Patron("Jacques-Hubert", 7000, 5000); | |
System.out.print(jaques_hubert.getSalaire()); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Patron extends Employe { | |
int prime; | |
Patron(String nom, int salaire, int prime) { | |
super(nom, (salaire + prime)); | |
} | |
public int getPrime() { | |
return prime; | |
} | |
public void setPrime(int prime) { | |
this.prime = prime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment