API  1.0.0
<CPObject> Protocol Reference

The root class from which most classes are subclassed. More...

+ Inheritance diagram for <CPObject>:

Instance Methods

(Class) - class
 
(BOOL) - conformsToProtocol:
 
(CPString- debugDescription
 
(CPString- description
 
(CPUInteger) - hash
 
(BOOL) - isEqual:
 
(BOOL) - isKindOfClass:
 
(BOOL) - isMemberOfClass:
 
(BOOL) - isProxy
 
(id) - performSelector:
 
(id) - performSelector:withObject:
 
(id) - performSelector:withObject:withObject:
 
(BOOL) - respondsToSelector:
 
(id) - self
 
(Class) - superclass
 

Detailed Description

The root class from which most classes are subclassed.

CPObject is the root class for most Cappuccino classes. Like in Objective-C, you have to declare parent class explicitly in Objective-J, so your custom classes should almost always subclass CPObject or one of its children.

CPObject provides facilities for class allocation and initialization, querying runtime about parent classes and available selectors, using KVC (key-value coding).

When you subclass CPObject, most of the time you override one selector - init. It is called for default initialization of custom object. You must call parent class init in your overridden code:

- (id)init
{
    self = [super init];
    if (self) {
        ... provide default initialization code for your object ...
    }
    return self;
}
One more useful thing to override is description(). This selector
is used to provide developer-readable information about object. description
selector is often used with CPLog debugging:
<pre>- (CPString)description

{ return [CPString stringWithFormat:"<SomeClass d>", someValue]; } To get description value you can use %@ specifier everywhere where format specifiers are allowed:

var inst = [[SomeClass alloc] initWithSomeValue:10];
CPLog("Got some class: %", inst);
    would output:
    Got some class: <SomeClass 10> 

Definition at line 69 of file CPObject.j.

Method Documentation

◆ class()

- (Class) class

◆ conformsToProtocol:()

- (BOOL) conformsToProtocol: (Protocol)  aProtocol

◆ debugDescription()

- (CPString) debugDescription
optional

◆ description()

- (CPString) description

◆ hash()

- (CPUInteger) hash

◆ isEqual:()

- (BOOL) isEqual: (id)  object

◆ isKindOfClass:()

- (BOOL) isKindOfClass: (Class)  aClass

◆ isMemberOfClass:()

- (BOOL) isMemberOfClass: (Class)  aClass

◆ isProxy()

- (BOOL) isProxy

◆ performSelector:()

- (id) performSelector: (SEL)  aSelector

◆ performSelector:withObject:()

- (id) performSelector: (SEL)  aSelector
withObject: (id)  object 

◆ performSelector:withObject:withObject:()

- (id) performSelector: (SEL)  aSelector
withObject: (id)  object1
withObject: (id)  object2 

◆ respondsToSelector:()

- (BOOL) respondsToSelector: (SEL)  aSelector

◆ self()

- (id) self

◆ superclass()

- (Class) superclass

The documentation for this protocol was generated from the following file: