11.07.2015 Views

tYSR20

tYSR20

tYSR20

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

178Part III: Introduction to Classes};// declare but don’t define member functionfloat deposit(float amount);unsigned int accountNumber;float balance;Using an include like this is pretty slick. Now a program can include the classdefinition (along with the definition for the member function), as follows inthe venerable SavingsClass_inline program://// SavingsClassInline - invoke a member function that’s// both declared and defined within// the class Student//#include #include #include using namespace std;#include “Savings.h”int main(int nNumberofArgs, char* pszArgs[]){Savings s;s.accountNumber = 123456;s.balance = 0.0;// now add something to the accountcout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!