title: How Does Getting the Address of a Class Member Through a Scope Resolution Operator Work When Using a Pointer-to-Member?
body: <p>When using a pointer-to-member (AKA dot-star or arrow-star) to access a class member, we can use the following syntax:</p>
  
  <pre><code>A * pa;
  int A::*ptm2 = &amp;A::n;
  std::cout &lt;&lt; "pa-&gt;*ptm: " &lt;&lt; pa-&gt;*ptm &lt;&lt; '\n';
  </code></pre>
  
  <p>My question is how does the <code>&amp;A::n</code> statement work?</p>
  
  <p>In the above example <code>n</code> is a variable.  If instead of a member variable, <code>n</code> was a function (and we defined a pointer-to-a-member-function instead of a pointer-to-a-member), I might reason that since a class's functions can be effectively static (see Nemo's comment), we could find a class's function's address via <code>&amp;A::some_function</code>.  But how can we get the address of a non-static class member through a class scope resolution?  This is even more confusing when I print the value of <code>&amp;A::n</code> because the output is merely <code>1</code>.</p>