Posts Tagged ‘Design Patterns’
Secret Creator SOLVED [Problem of the Week]
After a vigorous week of solutions to this hard problem, I will now post my solution … Read the rest of this entry »
Secret Creator [Problem of the Week]
After the Design Patterns course has ended in FCIS, and following up with the wicked problems of my friend, Fouad, I decided to post a code design problem I heard lately …
class Secret
{
// TODO: class body goes here ..
}
class Creator
{
// TODO: class body goes here ..
}
You have two classes: Secret and Creator.
Code both classes such that no other class than Creator is allowed to instantiate a local object of Secret. In other words, I can create an object of Secret as long as this code is inside Creator. If I’m inside any other class than Creator, I can’t!!! Read the rest of this entry »

RSS - Posts