Medium
You need to develop a program that allows you to send emails to different types of contacts. These emails will be formatted differently depending on the type of contact.
Contact types could be individuals, companies, mailing lists. This led you to develop Person
, Company
, and ListOfPerson
classes that have no inheritance relationship between them.
What would be the best strategy to offer a method of sending personalized email to these contacts regardless of their form?
Author: Eric HostaleryStatus: PublishedQuestion passed 1413 times
Edit
3
Community EvaluationsNo one has reviewed this question yet, be the first!
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
Which design pattern allows to dynamically add responsibilities to an object?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
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?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?