title: Delegation in C++
body: <p>I am trying to understand delegation in c++. I read that "delegation is pointer to function", and i saw several examples, but unfortunately I cant get it. I have created code to try, because I thought that maybe while programming i will understand it. Unfortunately I didn't.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  class person{
      private: 
          int age;
      public:
          person(age){
              this-&gt;age = age;
          }
  
          // virtual void changeAge(int arg) = 0;
  };
  
  class addNumber {
      public:
          int changeAge(int arg) {
              arg += arg+1; 
          }
  };
  
  int main(){
      person Olaf;
  }
  </code></pre>
  
  <p>So based on this <a href="https://stackoverflow.com/questions/9568150/what-is-a-c-delegate">source</a> I tried:</p>
  
  <pre><code>Olaf = &amp;addNumber::changeAge(10);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>addNumber test;
  
  Olaf = &amp;addNumber::changeAge(10);
  </code></pre>
  
  <p>Both does not work. That means program is not compiling. 
  I want to make person object to use <code>changeName</code> of <code>addNumber</code> class method to change the age of instance person class.</p>