i am trying to understand how can i access private classes through public classes because some experts said to me that i have to use only private classes. But i can't understand why this doesn't work.I really don't know how can i access private through public its really confusing .
#include <iostream>
#include <string>
using namespace std;
class ManolisClass{
public :
void setName(string x){
name = x;
}
string getName(){
return name;
}
private :
string name;
};
int main()
{
ManolisClass bo;
getline(cin, bo.setName() );
cout << bo.getName();
return 0;
}