class WifiNetDevice : public NetDevice
{
public:
static TypeId GetTypeId (void);
};
}
I want to know why in this header , he write "class WifiChannel" , "class WifiPhy" and "class WifiMac" in stead of adding them by include when they are already existed?
What is the advantage of doing that ?
C++ files are read from top to bottom. A declaration must be available before the C++ compiler can realize what it actually is. Even if it's defined below its use, it still doesn't know it exists because it hasn't seen it yet.
This is actually one of the larger complaints about C++ and it could be avoided if it were addressed but would increase compile time as yet another pass would be required (which I think five passes are already made in a naive compiler).