views:

53

answers:

1

Assume a valid super class, and a valid subclass ie the classes work.

the following line in a constructor of the subclass self = [super init] ;

throws the following warning // warning: incompatible Objective-C types assigning 'struct Animal *', expected 'struct Cat *'

Any ideas on how to fix this and remove the warning ?

Cheers

+5  A: 

Do you provide a custom init-Method in your superclass?

Check the return type of this method. Is it (Animal *)? If so, change this to (id).

Init methods should return (id)

fluchtpunkt
Thanks fluchtpunkt.Changed to (id)<http://developer.apple.com/library/mac/#documentation/cocoa/conceptual/objectivec/articles/ocAllocInit.html>
kjtl