Re: Porting 'operator' to Obj-C
Re: Porting 'operator' to Obj-C
- Subject: Re: Porting 'operator' to Obj-C
- From: Robert Claeson <email@hidden>
- Date: Fri, 26 Sep 2008 17:13:11 +0200
On 26 Sep 2008, at 17:03, Alex Finkel wrote:
Hi there.
I am in a process of porting some C++ code to ObjC. How to port the
code
bellow (operators). Thanks.
---- snip -----
operator= is a normal assignment method that takes an NSArray as its
argument. Something like the following (untested) code, depending on
what the rest of the C++ class looks like:
- (void)setEncodings:(NSArray *)encoding {
_count = [encoding size];
_encodings = [encoding copy];
}
But I wouldn't even have the _count instance variable. It's just as
easy to just ask the _encodings array for its size whenever needed.
The other methods are left as an exercise to the reader.
I originally learned C++ back in the 80's from a guy named Bjarne
Stroustrup, but I'd pick Objective C any time.
Robert
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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