S
Steven T. Hatton
It was once suggested to me that I could accomplish much the same thing that
modules would accomplish (if C++ had modules) by writing my entire program
- except for main() - inside of a class. When it was suggested, I didn't
take it very seriously, but I have recently begun wondering if it is an
idea worth considering. I'm now trying to think of what fundamental
differences might exist between namespace scope, and class scope.
One that I can think of is that I would not be able to have a using
declaration or directive at class scope. I'm not convinced that is a great
loss. Can anybody think of other restrictions or differences that might
exist if a class were used as something of an instantiated namespace?
Is anybody aware of an example of this kind of design being used
(effectively)?
modules would accomplish (if C++ had modules) by writing my entire program
- except for main() - inside of a class. When it was suggested, I didn't
take it very seriously, but I have recently begun wondering if it is an
idea worth considering. I'm now trying to think of what fundamental
differences might exist between namespace scope, and class scope.
One that I can think of is that I would not be able to have a using
declaration or directive at class scope. I'm not convinced that is a great
loss. Can anybody think of other restrictions or differences that might
exist if a class were used as something of an instantiated namespace?
Is anybody aware of an example of this kind of design being used
(effectively)?