View Single Post
Old 04-22-2005, 01:47 AM   #3 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
This is a nice one:
Code:
Clothing::Clothing() {
    cout << "It is impossible to create a Clothing item, which isn't named anything" << endl;
}
We might not be interested in such an object at all. Let's use a trick:
Declare the default constructor private. And don't implement it. so only:
Code:
class Clothing
{
public:
   //...
private:
   Clothing();
};

int main()
{
   Clothing MyClothes; //illegal
}
__________________
Valmont is offline   Reply With Quote