• 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: Question on Objective C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on Objective C++


  • Subject: Re: Question on Objective C++
  • From: Chris Thomas <email@hidden>
  • Date: Wed, 06 Mar 2002 11:51:52 -0800

On 3/6/02 10:36 AM, "Lance Bland" <email@hidden> wrote:

> last time I checked ...
>
> On Wednesday, March 6, 2002, at 12:46 PM, Oscar Morales Vivs wrote:
>
>> The docs state that the only C++ object instances that you can put in
>> an Objective-C object are those that don't have virtual functions.
>
> I find that hard to believe. The docs must be wrong. It probably means
> you can only place pointers and new them on the freestore. You probably
> can't have value or reference definitions.

I'm pretty sure the docs are correct on this point. You can define a C++
class as an inline value, as long as the class has no vtable. The following
is perfectly legal:

class Funky {int a;};

@interface Groovy
{
Funky my_funk;
}
@end

The release note explains:

> C++ requires each instance of a class containing virtual functions to contain
> a suitable virtual function table pointer. However, the Objective-C runtime
> cannot initialize the virtual function table pointer, because it is not
> familiar with the C++ object model.

Chris
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Question on Objective C++
      • From: Lance Bland <email@hidden>
References: 
 >Re: Question on Objective C++ (From: Lance Bland <email@hidden>)

  • Prev by Date: Re: Question on Objective C++
  • Next by Date: Re: Question on Objective C++
  • Previous by thread: Re: Question on Objective C++
  • Next by thread: Re: Question on Objective C++
  • Index(es):
    • Date
    • Thread