class Schet { double saldocredit = 0; void Add (double summ) { saldocredit = saldocredit + summ;}}
Schet s01;
C++ (Qt)#include <iostream> class Schet { public: double saldocredit = 0; void Add (double summ) { saldocredit = saldocredit + summ; }}; int main(int argc, char *argv[]){ Schet s; s.Add(2); // 2 std::cout << s.saldocredit << "\n"; s.Add(2); // 4 std::cout << s.saldocredit << "\n"; s.Add(2); // 6 std::cout << s.saldocredit << "\n"; return 0;}
class ProvodkaRecord {public: bool SetProvodkaRecordSumm(Schet fromschet, Schet toschet, double summa) { //отнимаем от счета fromschet fromschet.Snyat(summ); //прибавляем к счету toschet toschet.Vnesti(summ); return true; } }class Provodki {private: vector<ProvodkaRecord> ProvodkiList;public: bool AddProvodka (Schet fromschet, Schet toschet, double summa) { ProvodkaRecord tmp; tmp.SetProvodkaRecordSumm(fromschet, toschet, summa); ProvodkiList.push_back(tmp); return true; }};
///и вызов - снятьь с s01 и добавить к s10:MyProvodkiList.AddProvodka(s01, s10, 1200);
s01.Vnesti(5200); s01.Snyat(1200);
public: bool AddProvodka (Schet* fromschet, Schet* toschet, double summa) {
MyProvodkiList.AddProvodka(&s01, &s10, 1200);
C++ (Qt)bool AddProvodka (Schet& fromschet, Schet* toschet, double summa); MyProvodkiList.AddProvodka(s01, &s10, 1200);