Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 06-29-2009, 03: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: 3,858
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?)
__________________

Free Games!
smasher is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 158,677
Threads: 89,156
Posts: 380,395
Top Poster: BrianSlick (7,110)
Welcome to our newest member, Buster2000
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:24 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.