开发者

Can you upcast in objective-c and how?

Can you upcast in objective-c? if so how?


C# example:

"Asset" is the base class.

Stock msft = new Stock(); 
Asset a = msft;            //开发者_如何学Goupcast


You mean typecast a subclass object to the type of a superclass? Sure - Objective-C has very liberal typecasting rules, just like C.

Superclass *superclassObject = (Superclass *)subclassObject;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜