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 <rahul23111...@gmail.com>wrote:

> 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.com>wrote:
>
>> write..
>>
>> Abc a=Abc()
>>
>> it will execute...
>>
>>
>> On Fri, Mar 9, 2012 at 8:15 PM, ~*~VICKY~*~ <venkat.jun...@gmail.com>wrote:
>>
>>> #include<iostream>
>>> using namespace std;
>>> class Abc
>>> {
>>>
>>>     public :
>>>     int i;
>>>     Abc(){ i = 0;}
>>>
>>> };
>>> int main()
>>> { Abc a = new Abc();
>>>     cout<<a.i;
>>> }
>>>
>>>
>>> --
>>> Cheers,
>>>
>>>   Vicky
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards....
>>
>> Sanjiv Yadav
>>
>> MobNo.-  8050142693
>>
>> Email Id-  sanjiv2009...@gmail.com
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to