Do not remove methods for the sake of efficiency - use inline methods instead. For example: class Account { protected: int accountNumber; public: // an example inline method int getAccountNumber() { return accountNumber; } }; This is better than making the int getAccountNumber(); //accessor void setAccountNumber(int newNumber); //mutator The main advantage of this format is that access can be controlled to the We can also declare standalone methods (global methods) to be inline, such as: inline int account::getAccountNumber() { //etc } These notes are copyright Dr. Derek Molloy, School of Electronic Engineering, Dublin City University, Ireland 2013-present. Please contact him directly before reproducing any of the content in any way. |