Re: [algogeeks] A strange doubt with cpp class. Why compile error ?

2012-03-10 Thread Moheed Moheed Ahmad
Isn't Abc() a constructor which means to construct the object. No need for new.. -Cheers Moheed I am who I am, no matter where I am or who I am with. * * On Fri, Mar 9, 2012 at 9:16 PM, atul anand atul.87fri...@gmail.com wrote: may u r confused with java Abc a ; // this itself is

[algogeeks] A strange doubt with cpp class. Why compile error ?

2012-03-09 Thread ~*~VICKY~*~
#includeiostream using namespace std; class Abc { public : int i; Abc(){ i = 0;} }; int main() { Abc a = new Abc(); couta.i; } -- Cheers, Vicky -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

Re: [algogeeks] A strange doubt with cpp class. Why compile error ?

2012-03-09 Thread sanjiv yadav
write.. Abc a=Abc() it will execute... On Fri, Mar 9, 2012 at 8:15 PM, ~*~VICKY~*~ venkat.jun...@gmail.com wrote: #includeiostream using namespace std; class Abc { public : int i; Abc(){ i = 0;} }; int main() { Abc a = new Abc(); couta.i; } -- Cheers,

Re: [algogeeks] A strange doubt with cpp class. Why compile error ?

2012-03-09 Thread rahul sharma
on left side of new there should be pointer that should collect the address of the memory allocated.. write. ABC *a=new ABC(); correct if wrng... On Fri, Mar 9, 2012 at 8:19 PM, sanjiv yadav sanjiv2009...@gmail.comwrote: write.. Abc a=Abc() it will execute... On Fri, Mar 9, 2012 at

Re: [algogeeks] A strange doubt with cpp class. Why compile error ?

2012-03-09 Thread atul anand
may u r confused with java Abc a ; // this itself is creating an object of type ABC in C++ , no need to use new keyword to allocate m/m. where as in C++ new keyword allocate m/m and return an address , so to make it work do. Abc *a=new ABC(); On Fri, Mar 9, 2012 at 8:28 PM, rahul sharma