hirax.net::Tech-logs::2009-05-02

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;