• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: objective-C++ newbie question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: objective-C++ newbie question


  • Subject: Re: objective-C++ newbie question
  • From: Keith Ray <email@hidden>
  • Date: Mon, 25 Apr 2005 08:09:10 -0700

class2 header file:

class class1; // "forward" declaration to avoid #including class1 header file

@interface class2 : NSObject
{
   class1 * myClass1;
}
-(id) init;
-(void) dealloc;
@end

class2 source file:
#import "class2.h"
#import "class1.h"

@implementation class2
-(id) init
{
   self= [super init];
   if ( self != nil )
   {
      myClass1 = new class1;
   }
}
-(void) dealloc
{
    delete myClass1;
    [super dealloc];
}

On 4/25/05, Aaron Boothello <email@hidden> wrote:
> Hey people,
> As some of you might know ive started using Objective-C++ for a project im implementing. All code compiles just fine. But...
> first class(C++):
> lets call it 'class1'
>
> second class(Objective C):
> ive have to have an instance of class1 in this class. I know you can only declare them i nthe obejctive-C class as a pointer. thats fine. But where/when can i actually declare the instance of class1 ? Do i have to declare it when the app starts up ?
>
> My app is primarily an Obejctive-C Cocoa app. ive had to include class1 to extend the functionality.
>
> Im  a bit confused, so forgive my newbie-ness.
>
> Cheers,
> Aaron.
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>


--

C. Keith Ray
<http://homepage.mac.com/keithray/blog/index.html>
<http://homepage.mac.com/keithray/xpminifaq.html>
<http://homepage.mac.com/keithray/resume2.html>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: objective-C++ newbie question
      • From: "John C. Daub" <email@hidden>
    • Re: objective-C++ newbie question
      • From: James Dessart <email@hidden>
References: 
 >objective-C++ newbie question (From: Aaron Boothello <email@hidden>)

  • Prev by Date: Re: [ANN] MyGraphView:NSView sample code available
  • Next by Date: Re: CGShading and printing?
  • Previous by thread: Re: objective-C++ newbie question
  • Next by thread: Re: objective-C++ newbie question
  • Index(es):
    • Date
    • Thread