4

I have class A and B:

class A
{
protected:
    void someFunc() {};
};

class B : public A
{
public:
    B()
    {
         auto a = std::bind(&A::someFunc, this);
    }
};

Why I cannot use bind for protected method someFunc? It should be accessible as I bind it with this.

Narek
  • 38,779
  • 79
  • 233
  • 389
  • 3
    Use `&B::someFunc` instead of `&A::someFunc`. – Nawaz Dec 01 '15 at 13:13
  • 1
    I have read the question marked as duplicate, but could not understand. Actually @Nawaz helped me. Used `B::someFunc` and it worked nice. – Narek Dec 01 '15 at 13:23
  • @Nawaz please write and answer and I will accept it. In that way the others who will look for the solution of this problem will easily find it as not all comments are being red usually. – Narek Dec 02 '15 at 06:11
  • Once a question is marked as duplicate, it is closed and you can no longer post an answer. – Nawaz Dec 02 '15 at 08:09

0 Answers0