Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > Mac Programmer Help > Re: Objective-C...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 8 Topic 3791 of 3882
Post > Topic >>

Re: Objective-C++ Instance Variables

by William Woody <woody@[EMAIL PROTECTED] > Jul 4, 2008 at 04:24 PM

In article <oster-06D6C8.20465203072008@[EMAIL PROTECTED]
>,
 David Phillip Oster <oster@[EMAIL PROTECTED]
> wrote:

> In article <woody-33200E.17164003072008@[EMAIL PROTECTED]
>,
>  William Woody <woody@[EMAIL PROTECTED]
> wrote:

> > Note that this implies that you either #include the C++ header in your

> > Objective C header, or you need to declare the CPPClass in the
Objective 
> > C header as a anonymous C++ class. In either case, this means you can 
> > only #im****t your Objective C header in a .mm file.
> 
> Not So! Remember that in C++ 'struct' is the same as 'class' except in a

> 'struct' all the members default to public.  So, you can forward declare

> in your Obj-C.h file:
> 
> typedef struct CPPClass CPPClass;
> 
> this lets you include your .h file in a .c file just fine.

True 'nuff; however, I always get nervous doing that because at some 
point the C++ compiler will see:


typedef struct CPPClass CPPClass;

....

class CPPClass {
....
};

My fear is that someday some compiler will ***** with the 'struct 
CPPClass'/'class CPPClass' mismatch. Semantically 'struct' == 'class' 
for now, but I've been bit in the past by similar issues where the 
semantics subtly changed over time.


Call me conservative to the point of paranoid about such things... :-)

-- 
William Edward Woody   -   woody@[EMAIL PROTECTED]
 In Motion        -   http://www.chaosinmotion.com

Freedom is the non-negotiable demand of human dignity; 
the birthright of every person‹-in every civilization.
            - National Security Strategy of the United States
 




 8 Posts in Topic:
Objective-C++ Instance Variables
Jason8 <jason.leach@[E  2008-07-03 00:11:05 
Re: Objective-C++ Instance Variables
Gregory Weston <uce@[E  2008-07-03 07:52:36 
Re: Objective-C++ Instance Variables
Jason8 <jason.leach@[E  2008-07-03 07:44:01 
Re: Objective-C++ Instance Variables
Gregory Weston <uce@[E  2008-07-03 12:31:13 
Re: Objective-C++ Instance Variables
William Woody <woody@[  2008-07-03 17:16:40 
Re: Objective-C++ Instance Variables
David Phillip Oster <o  2008-07-03 20:46:53 
Re: Objective-C++ Instance Variables
William Woody <woody@[  2008-07-04 16:24:53 
Re: Objective-C++ Instance Variables
David Phillip Oster <o  2008-07-04 19:48:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 11:09:05 CST 2008.