|
Re: Agile C++?
|
Posted: Jan 7, 2005 3:06 AM
|
|
>For instance, at the very least I would expect object-oriented primitives.
What would you gain from all primitives being objects? I.e. what would you be able to do with an "int" object, that you can't do with an "class { int name; };" object?
Also, interestingly, the C++ standard defines both built-in and user-defined types as objects, quite appropriately, IMO. The built-in types may be considered to have operator functions, etc.
If "int" were to be an object, how would you refer to the value in the subclass, if you inherit from it. E.g. (not C++ code):
class derived : public int { // How to refer to the int, here? };
In "The Design and Evolution of C++", Bjarne Stroustrup writes that he considered being able to derive from the built-in types, but decided against it, since you may get a similar effect by wrapping it in a class.
Regards,
Terje
|
|