These are different if you have a closing area.
Case 1:
class B { };
namespace test {
class B;
class A {
public:
B fun1() const;
B* m_b;
};
class B { int x; };
}
Case 2:
class B { };
namespace test {
class A {
public:
class B fun1() const;
class B* m_b;
};
class B { int x; };
}
More details:
class B;is one of two things. This is either a renewal or a forward declaration that introduces the name Binto the current scope (ยง9.1 [class.name] / p2 of the standard).
class B . -, , , B, (ยง3.4.4 [basic.lookup.elab]/p2, ยง9.1 [class.name]/p3 note). , .
, . , . , , ; , , , (ยง3.3.2 [basic.scope.pdecl]/p7). , ; , .
? -, , . -, . , , test::B test::A, class B test::A test::B, ::B. -, , ?