What is difference in expressions foo->bar()
and (*foo).bar()
?
Those choices has equal results. So the code:
string *str = new string("Hello");
cout<<str->c_str()<<endl;
cout<<(*str).c_str()<<endl;
prints:
Hello
Hello
Maybe foo->bar()
and (*foo).bar()
difference in assembly code and memory usage?