title: How to hide some members of an object to a function while visible to another function?
body: <p>I usually use C programming language. Something is inconvenient for me in OO programming. I want the visibility of members in an object to depend on functions' requirement.  Say,</p>
  
  <pre><code>class Aclass{
   int i;
   float x;
  } A;
  </code></pre>
  
  <p>For function </p>
  
  <pre><code>float f(Aclass &amp;A) {
    cout&lt;&lt;"A.x="&lt;&lt; x &lt;&lt;endl;
  }
  </code></pre>
  
  <p>I want actually only x is visible to f. </p>
  
  <p>But for function</p>
  
  <pre><code>float I(Aclass &amp;A) {
    cout&lt;&lt;"A.i="&lt;&lt; A.i &lt;&lt;endl;
  }
  </code></pre>
  
  <p>I want only i is visible to I.</p>
  
  <p>In more realistic situation, an object has a lot of members.  How could I make different part of members visible to different functions?</p>