Advertisement
martukha

internet.h

Dec 27th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.81 KB | None | 0 0
  1. #pragma once
  2. #include"taryf.h"
  3. using namespace std;
  4. class Internet :public Taryf {
  5. protected:
  6.     static double zainternet;
  7.     double gb;
  8. public:
  9.     Internet() :Taryf(), gb(0) {}
  10.     Internet(string n1, string m1, double c1, unsigned t) : Taryf(n1, m1, c1), gb(t) {}
  11.     Internet(const Internet& i) : Taryf(i), gb(i.gb) {}
  12.  
  13.     double get_suma() const {
  14.         return (cost + (gb * zainternet));
  15.     }
  16.  
  17.     friend ostream& operator<<(ostream& out, const Internet& i) {
  18.         out << (Taryf&)i << "Borg:" << i.gb << "Gb" << "\t" << "Do splaty:" << i.get_suma() << endl;
  19.         return out;
  20.     }
  21.     friend istream& operator>>(istream& in, Internet& i) {
  22.         in >> (Taryf&)i;
  23.         in >> i.gb;
  24.         return in;
  25.     }
  26.     void print() const {
  27.         Taryf::print();
  28.         cout << "Internet:" << gb << "Gb" << "\t" << "Do splaty:" << Internet::get_suma() << endl;
  29.     }
  30. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement