Accueil>Tests>Questions>Que retourne le code suivant ?
public class A {
public void talk() {
echo "I am A"
}
public secretTalk() {
this.talk()
}
}
public class B extends A {
private void talk() {
echo "I am B"
}
public secretTalk() {
this.talk()
}
}
A b = new B()
b.talk()
b.secretTalk()
Answer : "I am A" "I am B"
Question du test Programmation orientée objet - Les bases
Que retourne le code suivant ? public class A { public void talk() { echo "I am A" } public secretTalk() { this.talk() } } public class B extends A { private void talk() { echo "I am B" } public secretTalk() { this.talk() } } A b = new B() b.talk() b.secretTalk() Answer : "I am A" "I am B"
Difficile
Que produit le code suivant ?
public class A {
public void talk() {
echo "I am A"
}
public secretTalk() {
this.talk()
}
}
public class B extends A {
private void talk() {
echo "I am B"
}
public secretTalk() {
this.talk()
}
}
A b = new B()
b.talk()
b.secretTalk()
Auteur: SamuelStatut : PubliéeQuestion passée 508 fois
Modifier