class - passing a string with white-spaces through a function in c++ -


i have class named blabla.

class blabla   {     public:                 void setname(const string &);     }  blabla toe;//creating object 

now,

string foe;  cin>>foe;  toe.setname(foe);//works fine 

but,

string loe;  getline(cin,loe);  toe.setname(loe);//compiles program overflows whenever function accessed..