6

I don't know how to explain this:

namespace A
{
struct B
{
  static void  f()
  {
  }
};
}

int  main()
{
  A::B::B::B::B::B::B::B::B::B::B::f();
}

Why could i do :

A::B::B::B::B::B::B::B::B::B::B::f();

I don't understand it why it's happening.

Ghasem Ramezani
  • 2,367
  • 1
  • 10
  • 28

1 Answers1

9

It is due to injected-class-name

inside class B, B refers to class B, as B::B.

so A::B::B refers to class B. and so on.

Jarod42
  • 190,553
  • 13
  • 166
  • 271