Embedding C++objects in Objective C++
Embedding C++objects in Objective C++
- Subject: Embedding C++objects in Objective C++
- From: Tommy Nordgren <email@hidden>
- Date: Thu, 30 Dec 2004 14:00:37 +0100
Are there any way to make xcode generate warnings instead of errors,
when compiling Objective C++ classes that embed C++ classes with
virtual methods. What i want to do is code according to the following
pattern (it works if the C++ class has userdefined constructors, but no
virtual methods:
class MyCPPClass {
int nn;
public:
MyCPPClass():nn(n) {};
~myCPPClass() {};
void print() const;
protected:
virtual void printSelf() const;
};
@interface MyClass : NSObject
{
MyCPPClass member;
}
- (void) print;
@end
@implementation MyClass
- (id) init
{
[super init];
new ((void *) &member) MyCPPClass(789); //Call constructor myself via
placement new
return self;
}
- (void) dealloc
{
member.~MyCPPClass(); //Explicit destructor call
[super dealloc];
}
- (void) print
{
member.print();
}
@end
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden