Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-29-2009, 02:18 AM   #4 (permalink)
smasher
Senior Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 2,573
Default

Quote:
Originally Posted by neduhamel View Post
Hi Smasher !

Thanks a lot for your reply.
the "initWithParent" sound like a good idea, but my problem is that i don't know technically how to define the parent class as a member of the child class.
How did you define the child class as a member of the parent class? You need the same thing - an instance variable and possibly a property.

This is how you'd define the initWithParent method. It will look funny if you've never written an init method before.

Code:
-(void) initWithParent: (id) parent
{
     self=[super init];
     if (self){
          my_parent=parent;
     }
     return self;
}
Note that I used "super" here because I need to call the init method of the class that B inherits from (B's superclass; probably NSObject?)
__________________
smasher is online now   Reply With Quote
 
Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,259
Threads: 39,050
Posts: 171,261
Top Poster: smasher (2,573)
Welcome to our newest member, andyarosh
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:21 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.