Presentation is loading. Please wait.

Presentation is loading. Please wait.

PH page 18-24 GoF Singleton p. 127-134 Emanuel Ekstrom.

Similar presentations


Presentation on theme: "PH page 18-24 GoF Singleton p. 127-134 Emanuel Ekstrom."— Presentation transcript:

1 PH page 18-24 GoF Singleton p. 127-134
Emanuel Ekstrom

2 Orphans & Adoption Context: Making a file system. Three objects: Node, File, Directory. Why do we need to adopt? Why do we need to orphan? Who gets an adopt/orphan interface? So are they all the same?

3 Singleton Intent: ”Ensure a class only has one instance, and provide a global point of access to it.”

4 Discussion Who needs only one instance?
What is good about a global access point? Why not global variables instead?

5 How do we make a Singleton? (GoF p. 131)
Constructor protected Public static Instance() function. Is this enough?

6 Discussion What if we want to delete a Singleton?
What if a deleted Singleton is called? Is there a solution to the problem?

7 Subclassing Problem: Making sure the subclasses are unique and that the clients can access it. How is this solved? Drawbacks?


Download ppt "PH page 18-24 GoF Singleton p. 127-134 Emanuel Ekstrom."

Similar presentations


Ads by Google