including .h files.

Posted by Max on Stack Overflow See other posts from Stack Overflow or by Max
Published on 2010-05-18T09:26:53Z Indexed on 2010/05/18 9:50 UTC
Read the original article Hit count: 124

Filed under:
|

Suppose I have two .h files: A.h and B.h. Moreover, A.h includes B.h itself:

B.h - declares class B.

class B {
  ...
};

A.h - declares class A, which uses class B.

#include B.h

class A {
  void SomeFunction(const B& b);
};

Now, I have some .cpp file, that uses both A and B classes (B class maybe used not only in A::SomeFunction(B))

What are the pluses to include both A.h and B.h (instead of only A.h) from the perspective of design-patterns and coding style.

© Stack Overflow or respective owner

Related posts about c++

Related posts about coding-style