NSObject是Objective-C中的Abstract类吗?但是我们可以创建NSObject的实例,那么它如何遵循Abstract类的规则? [英] Is NSObject is Abstract class in Objective-C? But we can create instance of NSObject, then how does it follow the rule of Abstract class?

查看:101
本文介绍了NSObject是Objective-C中的Abstract类吗?但是我们可以创建NSObject的实例,那么它如何遵循Abstract类的规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Objective-C中哪个类是Abstract类,我已经阅读了一些文档,其中NSObject是Abstract类,但是我们可以创建NSObject的实例,然后如何遵循抽象类规则.

Which class is Abstract class in Objective-C, I have read some doc where NSObject is Abstract class, but we can create instance of NSObject, then how it is follow the abstract class rule.

NSObject *obj = [[NSObject alloc] init];    
NSLog(@"description = %@",[obj description]);    
NSLog(@"class name = %@",[obj class]); 

请咨询.

我还听到了Objective-C中的另一个抽象类,该类的名称是什么?

And also I heard another one Abstract Class in Objective-C, what is the name of the class?

推荐答案

Objective-C没有实例化抽象类的编译时间限制.请参见在Objective-C中创建抽象类

Objective-C has no compile time restraint against instantiating abstract classes. See Creating an abstract class in Objective-C

这篇关于NSObject是Objective-C中的Abstract类吗?但是我们可以创建NSObject的实例,那么它如何遵循Abstract类的规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆