Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you need to start looking at Objective C from the start again it is not C++</p> <p>Your code example does not tell us that modelClass is a LectureModel so there are things missing so I might have misunderstood some things.</p> <p>First you have to call [super init] directly see <a href="http://developer.apple.com/mac/library/referencelibrary/GettingStarted/Learning_Objective-C_A_Primer/index.html#//apple_ref/doc/uid/TP40007594Blockquote" rel="nofollow noreferrer">Apple Objective C Primer</a>. </p> <p>In Objective C you use composition instead than inheritance more often than in C++ - In this example I would use delegation to allow use of dictionary. LectureModel will pass any messages it does not understand to the dictionary attribute. Also from <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/Reference/Reference.html#//apple_ref/occ/cl/NSDictionary" rel="nofollow noreferrer">NSDictionary</a> NSDictionary and NSMutableDictionary are part of a class cluster, so the objects you create with this interface are not actual instances of the these two classes. Rather, the instances belong to one of their private subclasses. </p> <p>So NSMutableDictionary is not really a good class to extend.</p> <p>This is partial code there are many parts missing including dealloc</p> <pre><code>@interface LectureModel : NSObject { NSMutableDictionary *dict; } ... @end @implementation LectureModel -(LectureModel*)init { if (self = [super init]) { dict = [[NSMutableDictionary dictionary]retain]; // need to keep this } return self; } - (void)forwardInvocation:(NSInvocation *)invocation // See NSObject for details { SEL aSelector = [invocation selector]; [invocation invokeWithTarget:dict]; // let dict do the work } ... @end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload