• 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++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C++


  • Subject: Re: Objective-C++
  • From: David Kopec <email@hidden>
  • Date: Wed, 15 Aug 2001 14:57:36 -0400

I believe that more complex applications of the below procedure will make for sloppy code. I find this troublesome. I was under the impression(wrongly so) that ObjectiveC++ would only allow Cocoa objects to contact C++ objects, and not the other way around. Hence C++ objects could become Model objects in the Model-View-Control paradigm. This is quite unfortunate, as I believe we will soon see applications utilizing the below technique and creating chaos.

David

On Wednesday, August 15, 2001, at 01:53 PM, Waqar Malik wrote:

It is very easy, here is an example from Apple.

// HelloWorld.mm
#import <Cocoa/Cocoa.h>
class HelloWorld;

@interface PLog: NSObject {
HelloWorld *ptr;
}
- (void)sayHello;
- (void)sayHi: (HelloWorld *)p;
- (id)init;
- (void)dealloc;
@end

class HelloWorld {
id printLog;
public:
HelloWorld(bool b) { if(b) printLog = [[PLog alloc] init]; }
~HelloWorld() { [printLog release]; }
void sayHi() { printf(Hi); }
void sayHello() { [printLog sayHi: this]; }
};

@implementation PLog
- (void) sayHello { NSLog(@"Hello, World!"); }
- (void) sayHi: (HelloWorld *)p { p->sayHi(); }
- (id) init { [super init]; ptr = new HelloWorld(false); return self; }
- (void) dealloc { delete ptr; [super dealloc]; }
@end
w.
On Wednesday, August 15, 2001, at 10:23 AM, David Kopec wrote:

This is indeed interesting. But can anyone enlighten me as to what "or
use Cocoa or
Foundation objects directly from within your C++ application." is
supposed to mean? How can I call Objective-C or Java classes from C++
using Objective-C++?

David

On Wednesday, August 15, 2001, at 01:15 PM, cocoa-dev-
email@hidden wrote:

Message: 12
Date: Wed, 15 Aug 2001 09:57:46 -0700
From: Heather Hickman <email@hidden>
To: email@hidden
Subject: Objective-C++

There has been a lot of discussion on the list lately as to whether or
not Obj C++ is a part of the upcoming
release of Mac OS X. I am pleased to announce that Mac OS X 10.1
introduces the Objective-C++ front-end to the
Mac OS X version of the GCC compiler, allowing you to freely mix C++ and
Objective C code in the same source file.

Objective-C++ allows you to use C++ class libraries directly from within
your Cocoa application, or use Cocoa or
Foundation objects directly from within your C++ application.


Heather Hickman
Cocoa Technology Manager
Worldwide Developer Relations
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


  • Follow-Ups:
    • Re: Objective-C++
      • From: Andreas Monitzer <email@hidden>
References: 
 >Re: Objective-C++ (From: David Kopec <email@hidden>)

  • Prev by Date: Re: AffineTransform an NSWindow?
  • Next by Date: Hardware Addressing
  • Previous by thread: Re: Objective-C++
  • Next by thread: Re: Objective-C++
  • Index(es):
    • Date
    • Thread