title: How can a compiler differentiate between static data members having same name in different classes in C++?
body: <p>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? </p>
  
  <p>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. </p>
  
  <p>Edit:
  I answered name mangling, but he refused saying name mangling is used only among the members of the same class.</p>