Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Jhorra

macrumors newbie
Original poster
Feb 5, 2007
9
1
Can anyone recommend a good starting place for me? I have developed in C#, and understand programming. I'm looking for some specifics for Cocoa and in a larger sense getting into C++ in general. My primary goal is to be able to write extensions and functionality for a program we are getting at my work. It's in C++, so I need to get started. I figured while I'm doing it, I might as well delve into Cocoa as well.
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
Cocoa doesn't strictly work with C++. Cocoa works with Objective-C and Carbon works with C and C++ but there is no specific C++ support.

You can use C++ with Qt or a number of other C++ enabled frameworks, if you're really interested in getting deep into C++ (and multiple platform) programming.
 

Stile

macrumors member
Jun 7, 2007
41
0
I believe your biggest hurdle going from C# to C++ will be pointers and memory management. I'd suggest picking up a beginning C++ book and just quickly going through it but mostly focusing on pointers and memory. There are a lot of similarities between the two languages though. One thing you'll probably miss though are events, I love those in the .Net languages. There are no interfaces either but you can kind of accomplish this with pure virtual functions and multiple inheritance, thought you should be very careful about using multiple inheritance and I might even get flamed for even suggesting it :D
 

mikesown

macrumors member
Aug 12, 2004
37
0
As a programmer who has done both C# and Cocoa(Obj-c) development, I can say that C# is a lot easier to use. Cocoa definitely has its ups- it's faster as it's compiled beforehand, but this comes at a price of memory management.

Additionally, Objective-C is a different kind of language. For example, in C#, you might call a quadratic solving function like this:
solveQuadratic(5,2,1);

In Objective-C, you would probably call it like this:
[solveQuadratic withA:5 andB:2 andC:1];
As you can see, the syntax is totally different; arguments have labels and everything is enclosed in brackets. A lot of people consider the Objective-C approach to be more elegant as it includes labels and as the entire function call is in brackets, but it definitely requires some getting used to after knowing Java/C#.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.