Advertisement
Guest User

oop 22 05 18

a guest
May 22nd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. using predicate = bool(*)(int);
  5.  
  6. class IntReader
  7. {
  8. public:
  9.     virtual bool read()=0;
  10.     virtual int getData()=0;
  11.     virtual bool isEmpty()=0;
  12. };
  13.  
  14. class IntFilterReader : public IntReader
  15. {
  16.     int n;
  17.     bool isClean;
  18. public:
  19.     IntFilterReader():isClean(false){}
  20.     bool read()
  21.     {
  22.         int temp;
  23.         cin>>temp;
  24.         if(n!=0 && predicate(n))
  25.         {
  26.             isClean = true;
  27.             n = temp;
  28.         }
  29.     }
  30.     int getData()
  31.     {
  32.  
  33.     }
  34. };
  35. int main()
  36. {
  37.     cout<<"Successful compilation!"<<endl;
  38.     return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement