Next: Beispiel (forts.)
Up: Objekte, Klassen, Variable, Funktionen,
Previous: Beispiel: Die Klasse Konto
Erzeugen Sie die Textdatei Account_IMP.cc mit folgendem Inhalt:
#include "Account_DEF.h"
Account::Account()
{
the_balance = 0.0;
}
float Account::account_balance(void)
{
return the_balance;
}
float Account::withdraw( const float money )
{
if ( money <= the_balance )
{
the_balance = the_balance - money;
return money;
}
else {
return 0;
}
}
void Account::deposit( const float money )
{
the_balance = the_balance + money;
}
| © 1997 Gottfried Rudorfer, C++-AG, Lehrveranstaltungen, Abteilung für Angewandte Informatik, Wirtschaftsuniversität Wien, 3/19/1998 |