use of pointer-to-member operators?
<p>I have come across the following code but not able to understand what is the importance of the following concept . Please help .</p>

<pre><code>#include &lt;iostream&gt;
using namespace std;

class cl 
{

public:
    cl(int i) { val=i; }
    int val;
    int double_val() { return val+val; }

};

int main()
{
    int cl::*data; // data member pointer
    int (cl::*func)(); // function member pointer
    cl ob1(1), ob2(2); // create objects
    cl *p1, *p2;
    p1 = &amp;ob1; // access objects through a pointer
    p2 = &amp;ob2;
    data = &amp;cl::val; // get offset of val
    func = &amp;cl::double_val; // get offset of double_val()
    cout &lt;&lt; "Here are values: ";
    cout &lt;&lt; p1-&gt;*data &lt;&lt; " " &lt;&lt; p2-&gt;*data &lt;&lt; "\n";
    cout &lt;&lt; "Here they are doubled: ";

    cout &lt;&lt; (p1-&gt;*func)() &lt;&lt; " ";
    cout &lt;&lt; (p2-&gt;*func)() &lt;&lt; "\n";
    return 0;
}
</code></pre>
