I'm learning iOS development right now and I came across concrete and abstract class. What are the difference between these class. I've searched online but they're in other languages not in Objective-C.
Asked
Active
Viewed 4,906 times
5
-
1Update your question with an actual example of what you are asking about. – rmaddy May 05 '14 at 04:16
-
This is a duplicate question and the accepted answer is misleading. – CrimsonChris May 06 '14 at 20:03
1 Answers
9
There is nothing to stop a person from instantiating a abstract class. There is no distinction between concrete and abstract classes.
A concrete class is one that is actually used "as is" for some purpose. A abstract class is a class that is subclassed but has little functionality on it's own. Example NSObject is a abstract class(never use it as is). UIActivityIndicator is a concrete class(pretty much always use it as is).
The only difference is that concrete classes are ready out of the box, and abstract classes are meant to be subclassed class.

Paulpjmmchugh
- 150
- 8
-
So it's like UIViewController where we subclass it and UINavigation controller where we instantiate it directly? – user3526002 May 05 '14 at 04:35
-
1
-
In Objective-c you can directly instantiate any class, but it won't be that useful to directly instantiate a class like NSObject or UIViewController. – Paulpjmmchugh May 05 '14 at 04:59
-
I instantiate UIViewControllers all the time. NSObject and UIViewController are NOT abstract classes. – CrimsonChris May 06 '14 at 17:36