I am a beginner with C++. When I write the code sometimes I write #include
and the code works, other times I don\'t write #include
If you're just using a pointer/reference to a user defined type, the type only needs to be declared:
class my_class;
void foo(const my_class& c);
But when you're using the value, the compiler needs to know the size and with that the definition of the type.
And keep in mind that standard headers may include other ones, which doesn't automaticly mean that all implementations do that, so you can't rely on that.