Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Wrapping my head around formal protocols
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Wrapping my head around formal protocols



Hi,

I am just starting to learn Objective-C (I've been programming in C++ for about 15 years).

My first "project" in Objective-C is to port something I wrote entirely in C++.

What I am finding is that my "OO" C++ implementation does not map very well to Objective-C.

For example, in C++ I have an abstract class that contains methods (some with a default implementation and some without) as well as data members.  In Obj-C this is a total no-no from what I can gather (a formal protocol can only contain method declarations). 

I guess I could create a "base" class that implements the protocol and then have all of my "concrete" base classes inherit from that base. ??

I won't argue that much of the "OO" in C++ is syntactic sugar, but unfortunately I've been thinking that way so long that it is difficult to think about an object hierarchy without having true abstract classes.

I wonder if many people just implement their model classes in C++ then write their view/controller classes in Obj-C?

Any suggestions/advice/clarifications would be greatly appreciated!

-2Cats



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.