Why should inheritance be a "subclass" of NSObject?

Why should inheritance start with NSObject and then use inheritance in another class?

I wonder why I have a subclass of "FatherClass" from the UIViewController. So I want to create an inheritance of FatherClass (ChildClass: FatherClass).

I can not do this, I get an error log. All the examples I searched here and Google start with NSObject as a father.

So my question should be like that? Or am I mistaken somewhere.

Here is the error log

#0  0x33d6c6f8 in CFStringGetCharacters ()
CoreFoundation`CFStringGetCharacters:
0x33d6c6f8:  push.w {r8, r10}

thank

EDIT HERE with code

FatherClass.h

@class ChildClass;
@interface FatherClass : UIViewController <UITabBarControllerDelegate, UINavigationBarDelegate, UIPopoverControllerDelegate, MKMapViewDelegate, MKAnnotation>
{
     //Some variables
}
@property (nonatomic, strong) ChildClass   *sidebar_table_controller;

-(void) show_modal: (id) sender; // Thats the Method i want to call
@end

FatherClass.m

#import "FatherClass.h"
#import "ChildClass.h"
@interface FatherClass ()

@end

@implementation FatherClass

@synthesize sidebar_table_controller;

// All inits here... DidiLoad, DidUnload, etc..

-(void) show_modal: (id) sender // Thats the Method!!!
{

      // All initiate ChildClass an then.. present modal

      [self presentModalViewController:self.sidebar_table_controller animated:YES];

      NSLog(@"Clicked ?...%@", sender);
}
@end

Now baby

ChildClass.h

@interface ChildClass : FatherClass <UINavigationControllerDelegate, UITableViewDataSource, UITableViewDelegate>
@end

ChildClass.m

#import "ChildClass.h"

@interface ChildClass ()

@end

@implementation ChildClass
 // All inits here... DidiLoad, DidUnload, etc..

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
     // Here i want to call Father Method
     [FatherClass show_modal:indexPath];
}

@end

When I change ChildClass: UIViewController to ChildClass: My application’s father disconnected.

+3
source share
2

: NSObject - . : NSObject ? , , init, dealloc .

, , , .

+1

Self. ,

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     // Here i want to call Father Method
     [Self show_modal:indexPath]; }

@property (nonatomic, strong) ChildClass   *sidebar_table_controller;

, , .

0

All Articles