34,333
edits
Changes
→Creating a New Class Method
== Creating a New Class Method ==
<google>ADSDAQBOX_FLOW</google>
In order to demonstrate the concept of class methods we are going to work on a simplified version of our BankAccount class and add write a class method that will count the number of instances of the BankAccount class that have been initiated. To do this we are going to write a new ''alloc'' method for class called ''newAlloc''. The ingredients we need to achieve this are as follows: