Advertisement
martukha

taryf.h

Dec 27th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #pragma once
  2. #include<iostream>
  3. #include<string>
  4. using namespace std;
  5.  
  6. class Taryf {
  7. protected:
  8.     string nomer;
  9.     string month;
  10.     double cost;
  11. public:
  12.     Taryf():nomer(), month(), cost(0){}
  13.     Taryf(string n, string m,double c): nomer(n),month(m),cost(c){}
  14.     Taryf(const Taryf&t): nomer(t.nomer),month(t.month),cost(t.cost){}
  15.  
  16.     string get_nomer() const {
  17.         return nomer;
  18.     }
  19.     virtual double get_suma()const {
  20.         return cost;
  21.     }
  22.     friend ostream& operator<<(ostream& out, const Taryf& t) {
  23.         out << "Number:" << t.nomer << "\t" << "Month:" << t.month << "\t" << "Cost:" << t.cost << "$" << endl;
  24.         return out;
  25.     }
  26.     friend istream& operator>>(istream& in, Taryf& t) {
  27.         in >> t.nomer;
  28.         in >> t.month;
  29.         in >> t.cost;
  30.         return in;
  31.     }
  32.     void print() const {
  33.         cout<< "Number:" << nomer << "\t" << "Month:" << month << "\t" << "Cost:" << cost << "$" << endl;
  34.     }
  35. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement