I l @ ve RuBoard |
So far you have used only function prototypes in the classes you've created. It is possible to define the body of the function inside the class itself. Consider the following code: class stack { public: // .... rest of class // Push an item on the stack void push(const int item); }; inline void stack::push(const int item) { data[count] = item; ++count; } This code can instead be written as: class stack { public: // .... rest of class // Push an item on the stack void push(const int item) { data[count] = item; ++count; } }; The inline directive is not required in the second case since all functions declared inside a class are automatically declared inline. |
I l @ ve RuBoard |