Build and test like so:
$ clang++ -std=c++11 test_class.cc main.mm -framework Foundation
$ ./a.out
2019-09-03 12:18:13.640 a.out[85486:6585983] The answer is 42
#import <Foundation/Foundation.h> | |
#include "test_class.h" | |
int main() { | |
TestClass tc; | |
NSLog(@"The answer is %d", tc.id()); | |
return 0; | |
} |
#include "test_class.h" | |
int TestClass::id() const { | |
return 42; | |
} |
class TestClass { | |
public: | |
int id() const; | |
}; |