Re: virtual ivars
Re: virtual ivars
- Subject: Re: virtual ivars
- From: Uli Kusterer <email@hidden>
- Date: Sun, 30 Aug 2009 10:37:18 +0200
Am 30.08.2009 um 00:39 schrieb Todd Heberlein:
So here is a slightly more detailed scenario while still trying to
keep it as simple as possible.
My "Model" is captured in C++ code (i.e., "CppObj" below). I want to
use normal Cocoa "View" objects (e.g., an NSTextField) and
"Controller" objects (e.g., NSObjectController). So I create an
Objective C object ("MyWrapper ") to wrap the C++ object, and access
to the C++ content is done through "properties". Both the setters
and getters reach down into the C++ object to set or get its values.
Things seem to be working. I just wanted to make sure I wasn't doing
something illegal or not supported. I guess I have always had
properties associated with actual variables, so it never occurred to
me before that they are really independent things.
Yes, that can't really break. It would violate the contract the API
documentation for KVO/KVC establish, which mentions getters and/or
setters, but doesn't require ivars anywhere. They're just what you
typically use in ObjC. Your case is not a typical ObjC case, but it's
a typical ObjC++ usage.
Just one note: This example is hopefully only that, an example.
Because it would be bad C++ style if you didn't call the actual C++
accessors and went messing with your C++ class's ivars directly from a
separate (ObjC) class.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden