Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <vector>
- #include <string>
- using std::vector;
- using std::string;
- using std::cout;
- using std::endl;
- //--------class--------
- class Client {
- public:
- //constructor
- Client(string name, int ID) {
- this->ID = ID;
- this->name = name;
- }
- //function that returns ID of client
- int return_ID() {
- return ID;
- }
- //function that returns name of client
- string return_name() {
- return name;
- }
- private:
- int ID;
- string name;
- };
- //---------------------------------------
- class Bank {
- private:
- //vector of clients
- vector<Client*> clients;
- public:
- //function for adding clients to vector
- void addclientd(Client* client) {
- clients.push_back(client);
- }
- //function for printing data of clients
- void print() {
- for (int i = 0; i < clients.size(); i++) {
- cout << "ID is " << clients[i]->return_ID() << " ";
- cout << "Name is " << clients[i]->return_name() << endl;
- }
- }
- };
- //---------------------------------
- int main() {
- Client Ivanov("Ivanov", 3234);
- Client Somebody("Somebody", 2345);
- Bank bank;
- bank.addclientd(&Ivanov);
- bank.addclientd(&Somebody);
- bank.print();
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment