Hard
Is it possible in an instance of a class to access the fields, that is, its member data, of another instance of the same class?
Author: Eric HostaleryStatus: PublishedQuestion passed 1429 times
Edit
0
Community Evaluations
Ab
18/04/2024
Doublon : https://welovedevs.com/fr/app/test-question/-M4-8q7PiN4A7IRO-v5t/-M4PV6mN5zOKkGFT_Zm3
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);8
Can we extend an abstract class in Java?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?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);4
Which design pattern allows to dynamically add responsibilities to an object?5
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
Can an interface inherit from another interface?