Hi
I am trying to allocate some memory inside a constructor.
The contructor can be invoked in context of nested object creation
(i.e object is member of another object ) or can be called
explicitly.
I want to know different ways to handle an error condition like when
memory alloc fails.
E.g
<<
Object::Object( int size){ array=new int[size] ; }
o = new Object(100);[color=blue][color=green]
>>[/color][/color]
If array == NULL, then how do i make 'o' as NULL?
or how do I check this condition?
balan
I am trying to allocate some memory inside a constructor.
The contructor can be invoked in context of nested object creation
(i.e object is member of another object ) or can be called
explicitly.
I want to know different ways to handle an error condition like when
memory alloc fails.
E.g
<<
Object::Object( int size){ array=new int[size] ; }
o = new Object(100);[color=blue][color=green]
>>[/color][/color]
If array == NULL, then how do i make 'o' as NULL?
or how do I check this condition?
balan
Comment