Expert
What will the following pseudo-code display?
class A
{
public function foobar() {
echo this->foo();
echo this->bar();
}
private function foo() {
return "A::foo\\n";
}
public function bar() {
echo "A::bar\\n";
}
}
class B extends A
{
private function foo() {
return "B::foo\\n";
}
public function bar() {
echo "B::bar\\n";
}
}
var toto = new B();
toto->foobar();
Author: Eric HostaleryStatus: PublishedQuestion passed 1377 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!
14
Is the following code valid?
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
}
const person = new Person('John', 20);
console.log(person.name);
console.log(person.age);8
Can we extend an abstract class in Java?4
Can an interface inherit from another interface?4
Is the following code valid?
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
}
const person = new Person('John', 20);
console.log(person.name);
console.log(person.age);4
Is the following code valid?
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
}
const person = new Person('John', 20);
console.log(person.name);
console.log(person.age);9
You need to develop a class for which there should be only one instance throughout your application. Which design pattern should you use for this?4
Is the following code valid?
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
}
const person = new Person('John', 20);
console.log(person.name);
console.log(person.age);