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,683
  • 1
  • 13
  • 32

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
  • 203,559
  • 14
  • 181
  • 302