2007年へ/ 2008年へ/ 2009年へ/ 2010年へ/ 2011年へ/ 2012年へ/
2009-05-02[n年前へ]
■Using C++ with Objective-C (and iPhone SDK) 
Using C++ with Objective-C (and iPhone SDK)
#ifndef FOO_H_INCLUDED
#define FOO_H_INCLUDED
class Foo
{
public:
void setId(int newId);
int getId();
private:
int myId;
};
#endif // FOO_H_INCLUDED
You can use it like this:
Foo *foo = new Foo;
foo->setId(16);
NSLog(@"foo id: %i", foo->getId());
// foo id: 16
delete foo;