I had a C++ interview recently where I was asked, how does the compiler differentiate static data members having the same name in two different classes?
Since all static data variables are stored in the data segment, there has to be a way by which the compiler keeps track of which static data belongs to which class especially when they have the same name.
Edit: I answered name mangling, but he refused saying name mangling is used only among the members of the same class.