Objective-C Lesson in Class Design

Posted by Pota Onasys on Programmers See other posts from Programmers or by Pota Onasys
Published on 2013-10-20T00:40:19Z Indexed on 2013/10/20 4:12 UTC
Read the original article Hit count: 351

Filed under:
|

I have the following classes:

   Teacher
   Student
   Class (like a school class)

They all extend from KObject that has the following code:

- initWithKey
- send
- processKey

Teacher, Student Class all use the functions processKey and initWithKey from KObject parent class. They implement their own version of send. The problem I have is that KObject should not be instantiated ever. It is more like an abstract class, but there is no abstract class concept in objective-c. It is only useful for allowing subclasses to have access to one property and two functions.

What can I do so that KObject cannot be instantiated but still allow subclasses to have access to the functions and properties of KObject?

© Programmers or respective owner

Related posts about ios

Related posts about objective-c