• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: programming in C++ ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: programming in C++ ?


  • Subject: Re: programming in C++ ?
  • From: Vance <email@hidden>
  • Date: Wed, 30 Jan 2008 15:42:56 -0800

Objective-C is only an extension to C or C++.
So from within your objective-c code, you can call C or C++ function, you can intermix the two.


Q: If I understand correctly then .mm files may contain Object-C and C++ mix.
A: Yes, the ".m" files can contain ObjC and C. The ".mm" files can contain ObjC and C++


Q: But if this is so, why are not all files .mm (why are .m files needed?).
A: Think of it as C and C++. In C we use .c as extension and in C++ we use .cpp as the file extension.


Q: And how do I call the Object-C functions?
A: You call them by sending message to objects. I strongly recommend you get the book "Cocoa programming for mac os x". It will tell you Obj-C as well as Cocoa.


Q: Does it hurt when I only use .mm files?
A: It depends on what you want to do.

Q: Does it makes sense to write Cocoa applications in C++?
A: Yes it does.


Cor wrote:
I'm very new to Cocoa, so I'm sorry if this is more or less a stupid question.

I want to make an application that uses the QTKit and some IOKit things.
For QTKit I seem te need to write in Objective-C.
For the IOKit I need to write in C++.

I'm a experienced C++ programmer, so I prefer to program in C++, but how do I interface to QTKit?

I did read something about .mm files.
If I understand correctly then .mm files may contain Object-C and C++ mix.
But if this is so, why are not all files .mm (why are .m files needed?).

And how do I call the Object-C functions?

Does it hurt when I only use .mm files?
Does it makes sense to write Cocoa applications in C++?

Thanks.
_______________________________________________

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

_______________________________________________

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


References: 
 >programming in C++ ? (From: "Cor" <email@hidden>)

  • Prev by Date: Re: reset alternating row background color
  • Next by Date: SliderText = NSSlider + NSTextField
  • Previous by thread: Re: programming in C++ ?
  • Next by thread: Re: programming in C++ ?
  • Index(es):
    • Date
    • Thread