Changes

Writing Objective-C Class Methods

22 bytes added, 20:00, 31 March 2011
The @implementation Section
@end
</pre>
<google>IOSBOX</google>
The first line of the implementation creates a static integer variable in which we will store the count of BankAccount instances and initializes it to 0. Within the body of the implementation we then have our ''newAlloc'' class method. This method increments the current value of the ''openAccounts'' integer before calling the standard ''alloc'' class method and returning a pointer to the allocated memory space.
The ''totalOpen'' class method simply returns the current value of the openAccounts variable.
== The main() Function ==