IPHONE: User-defined constructor/destructor

This is actually the second time I've come across this issue. Unfortunately I did not post the solution last time, so I had to go look it up again...

The WARNING:
type 'SomeClassType' has a user-defined constructor
tyep 'SomeClassType' has a user-defined destructor

The SOLUTION:
convert object declarations into pointer declarations. for example:
@interface myclass {
@private
SomeClassType myInstance;
}

change to:
@interface myclass {
@private
SomeClassType* myInstancePtr;
}

Of course, this also means you will have to manually control the instantiation & destruction of the object with new & free.

No comments: