While you can use Objective-C++, the main reservation is you cannot combine the semantics of the two languages. Objects of each language need to maintain clear divison, and only be created and deleted according to their native language.
So C++ objects use new/delete and Objective-C objects must use alloc/release -Kevin > Mr. Krishna: > > I, too am new to Objective-C, but in the two books I have been > studying on the language, they both make the point that Objective-C > plays nicely with both C and C++. Could you simply write a standard C++ > class and instantiate it the same way one does with other C++ classes > (i.e. by declaring it, or by using the new operator)? > > R, > John > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Rama Krishna > Sent: Thursday, April 10, 2008 1:22 PM > To: cocoa-dev@lists.apple.com > Subject: A simple Objective-C question > > I am new to Objective-C but I have done C++/C#/Java work. I have been > doing > some experiments to understand how the language works. I found that it > is > not necessary for an Objective-C class to derive from Object. I was able > to > create a class which did not derive from Object contrary to my > assumption > that all Objective-C classes implicitly derive from Object (such as in > C# or > Java). > > > > However, such a class has a problem. It cannot be allocated or > initialized. > Because it can never get the alloc message as the alloc message is > declared > in the Object class. My question ,therefore, is how can such classes be > instantiated. Is there a library function for that? Surely, the standard > alloc function must be using such a function. Or should I just derive > all > classes from Object. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]