MyObject obj = new MyObject(k);
foo(obj);
bar(&obj);
foo(MyObject &)
bar(MyObject *)
I know we need to use the passed parameter differently in the two functions, but apart from that, in terms of memory allocation or otherwise, is there a difference between the two? I mean for the reference also the compiler would be storing the memory pointer.