public keyword allows data variables and member function to be used from outside by any random class or random function.
protected keyword restrict the access of data variable and member function from outside. Only derived and friend function/class can access or modify private data variables and private member function.
private keyword further restrict the access of data variables and member functions. These private variables/function can used inside the class, and can be used from friend function or friend class.