The puzzle
The original puzzle is in Java http://wouter.coekaerts.be/2012/puzzle-clowns, so I tried to write it in C++ and post it here for your, so that you solve it and having some thing to think:-)
There almost aren’t any rules; any cheating inside your code is allowed; it is the whole point of the puzzle. But you cant change any members or any method, or modify the three classes, changes are not allowed for the three classes.
How can you fit 20 clowns into a Volkswagen? Three classes are given: an empty Clown class, a super class Synchronized, and a Volkswagen class to which you can add clowns. When you try to add a Clown, it is checked that it isn’t already full. But if you just try hard enough, there’s always room for some extra clowns…
1st Class
1 2 3 4 5
class Clown {
public:
Clown(){}
virtual ~Clown(){}
};