Hi,
The code at page # 299 is as follows:
Code:
public interface IMessagingService
{
void SendMessage();
}
public class EmailService : IMessagingService
{
public void SendMessage() { ... }
}
public class NotificationSystem
{
private IMessagingService svc;
public NotificationSystem()
{
svc = new EmailService();
}
public void InterestingEventHappened()
{
svc.SendMessage();
}
}
I think the constructor of NotificationSystem should not create a new object of EmailService. Instead, it should be IMessagingService.
Please justify if not so.