Objective-J/Class

From Wikibooks, open books for an open world
Jump to navigation Jump to search
  • Objective-J has two types of objects, native JS objects and Objective-J objects.
    • Native JS objects are exactly what they sound like, the objects native to JavaScript.
    • Objective-J objects are a special type of native object added by Objective-J. These new objects are based on classes and traditional inheritance, like C++ or Java, instead of the prototype model.

Creating a class

Here's an example of a Person class that contains one member variable, name:

@implementation Person : CPObject
{
       CPString name;
}
@end