开发者

warning: incompatible Objective-C types assigning superClass to subClass

开发者 https://www.devze.com 2023-01-18 08:18 出处:网络
Assume a valid super class, and a valid subclass ie the classes work. the following line in a constructor of the subclass

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 Objec开发者_如何学JAVAtive-C types assigning 'struct Animal *', expected 'struct Cat *'

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

Cheers


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消