I hope this question is not too silly, but what is the most basic class in stan开发者_如何学Cdard C++? object? Object?
class MyObject : public object{ ...
and I get "Expected class-name before token{"
Is there any map, diagram or image that shows standard c++ classes inheritance? Something like this but for C++ ?
There is no most basic class in C++ i.e. there is no common base class for all the classes.
There is no fundamental object type in C++, unlike in e.g. Java.
In Cocoa, the NSObject
class is fundamental to the framework but not to the Objective-C language itself. In Objective-C, it is possible to create a root class by not deriving from anything (but in order to make it work you'll probably have to hack your way through runtime calls).
Similarly, some C++-based frameworks may define a root class that all other classes in that framework derive from, but it is specific to the framework, not the language.
This is the simplest most basic class you can compile:
class Null
{
};
Inheritance diagram for IOstream library is here. STL is a template library and doesn't use OOP.
精彩评论