#include #include #include class Checking { public: Checking(unsigned accNo, float initialBalance) { accountNumber = accNo; balance = initialBalance; count++; if (pFirst == 0) { pFirst = this; } else { for (Checking *pC = pFirst; pC->pNext; pC = pC->pNext) { } pC->pNext = this; } pNext = 0; } static Checking *first() { return pFirst; } Checking *next() { return pNext; } void deposit(float amount) { balance += amount; } void display() { cout << "Konto " << accountNumber << " - " << balance << "\n"; } protected: static Checking *pFirst; Checking *pNext; static int count; unsigned accountNumber; float balance; }; Checking *Checking::pFirst = 0; int Checking::count= 0; int main() { Checking *pC; pC = new Checking(1,0.0F); if (pC == 0) { cout << "RAM \n"; } pC->deposit(100.00F); pC = new Checking(2,0.0F); if (pC == 0) { cout << "RAM \n"; } pC->deposit(50.00F); for (pC = Checking::first(); pC; pC = pC->next()) { cout << "!" << pC << "!"; pC->display(); } }