Advertisement
DmitryPythonDevelop

Untitled

Apr 3rd, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.01 KB | None | 0 0
  1. MAIN.CPP
  2. #include <iostream>
  3. #include <string>
  4.  
  5. // Классы для работы с аккаунтами пользователей и электронными кошельками
  6. #include "modules/money/money.h"
  7. #include "modules/account/account.h"
  8.  
  9. // ORM - система ( в данном случае 1 класс ) для работы с "БД"
  10. #include "modules/orm/orm.h"
  11.  
  12. using namespace std;
  13.  
  14. int main()
  15. {  
  16.     return 0;
  17. }
  18.  
  19. ACCOUNT.H
  20. #pragma once
  21.  
  22. #include <string>
  23.  
  24. #include "password.h"
  25. #include "../money/money.h"
  26.  
  27. // Возможные уровни привелигерованности
  28. enum available_privileges { ordinary=0, defendent, admin };
  29.  
  30. // Класс стандартного пользователя
  31. class Account
  32. {
  33.     protected:
  34.         char* FIO;
  35.         long INN;
  36.  
  37.         available_privileges privileges;
  38.  
  39.         WalletList wallet;
  40.     public:
  41.         Account (string newFIO, long newINN);
  42.         virtual ~Account();
  43.  
  44.         bool CreateWallet( char Currency[4] );
  45.         void DeleteWallet( char Currency[4] );
  46.  
  47.         bool AddMoney( long Summ, Money Wallet );
  48.         bool SendMoney( long INN, char Currency[4], long Summ );
  49. };
  50.  
  51. // Класс стандартного пользователя, чьи данные защищены паролем
  52. class AccountSecure : public Account {
  53.     protected:
  54.         SecurePassword password;
  55. };
  56.  
  57. // Класс контейнер аккаунтов
  58. template<typename type>
  59. class AccountList {
  60.     private:
  61.         struct AccountData {
  62.             type data;
  63.             AccountData* next;
  64.         };
  65.         AccountData *head, *tail;
  66.     public:
  67.         AccountList();
  68.         ~AccountList();
  69.  
  70.         void AddAccount(type account);    // Добавление аккаунта
  71.         void DeleteAccount(type account); // Удаление аккаунта
  72. };
  73.  
  74. // Класс администора
  75. class AccountAdmin : protected AccountSecure {
  76.     private:
  77.         // Списки обычных и защищенных пароле аккаунтов
  78.         AccountList<Account> ListAccount;
  79.         AccountList<AccountSecure> ListSecureAccount;
  80.     public:
  81.         AccountAdmin();
  82.         ~AccountAdmin();
  83. };
  84.  
  85. ACCOUNT.CPP
  86. #include "account.h"
  87.  
  88. using namespace std;
  89.  
  90. Account::Account(string newFIO, long newINN) {
  91.     this->privileges = ordinary;
  92.  
  93.     this->INN = newINN;
  94.  
  95.     this->FIO = new char[newFIO.length + 1];
  96.     strcpy( this->FIO, newFIO.c_str());
  97. }
  98.  
  99. Account::~Account() {
  100.     this->wallet.~WalletList();
  101.     delete[] this->FIO;
  102. }
  103.  
  104. MONEY.H
  105. #pragma once
  106.  
  107. class Money
  108. {
  109.     private:
  110.         char Currency[4];
  111.         long Summ;
  112.  
  113.     public:
  114.         Money(char Currency[4]);
  115.         ~Money();
  116.  
  117.         char* GetCurrency();        // Получить наименование валюты
  118.         long GetSum();              // Получить кол-во средств на счету
  119.  
  120.         void operator+ (long Summ); // Положить на счет
  121.         bool operator- (long Summ); // Снять со счета
  122. };
  123.  
  124. class WalletList
  125. {
  126.     private:
  127.         struct WalletData
  128.         {
  129.             Money data;
  130.             WalletData *next;  
  131.         }; 
  132.         WalletData *head, *tail;
  133.  
  134.     public:
  135.         WalletList();
  136.         ~WalletList();
  137.  
  138.         void AddMoney( Money &money );
  139.         void DeleteMoney( Money &money);
  140. };
  141.  
  142.  
  143. ОШИБКИ:
  144. dmitry@dmitry-Lenovo-ideapad-100-15IBY:~/Рабочий стол/Курсовая работа$ make -f MAKE.txt
  145. g++ -c modules/account/account.cpp -o bin/account.o
  146. In file included from modules/account/account.cpp:1:0:
  147. modules/account/account.h:22:19: error: expected ‘)’ before ‘newFIO’
  148.    Account (string newFIO, long newINN);
  149.                    ^~~~~~
  150. modules/account/account.cpp:5:1: error: prototype for ‘Account::Account(std::__cxx11::string, long int)’ does not match any in class ‘Account’
  151.  Account::Account(string newFIO, long newINN) {
  152.  ^~~~~~~
  153. In file included from modules/account/account.cpp:1:0:
  154. modules/account/account.h:12:7: error: candidates are: constexpr Account::Account(const Account&)
  155.  class Account
  156.        ^~~~~~~
  157. modules/account/account.h:12:7: error:                 Account::Account()
  158. MAKE.txt:10: recipe for target 'bin/account.o' failed
  159. make: *** [bin/account.o] Error 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement