Advertisement
hacityler

Untitled

May 9th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. template <class T>
  6. class eben{
  7. private:
  8. T a;
  9. T b;
  10. public:
  11. eben(T &_a, T &_b) : a(_a), b(_b)
  12. {}
  13. void addnum();
  14. void substract();
  15. void divide();
  16. };
  17.  
  18. template <class T>
  19. void eben<T>::addnum(/*T &a, T &b*/)
  20. {
  21. T sonuc;
  22. sonuc=a+b;
  23. cout<<sonuc<<endl;
  24. }
  25. template <class T>
  26. void eben<T>::substract(/*T &a, T &b*/)
  27. {
  28. T sonuc;
  29. sonuc=a-b;
  30. cout<<sonuc<<endl;
  31. }
  32. template <class T>
  33. void eben<T>::divide(/*T &a, T &b*/)
  34. {
  35. T sonuc;
  36. sonuc=a/b;
  37. cout<<sonuc<<endl;
  38. }
  39.  
  40. int main()
  41. {
  42. eben<int> obj;
  43. obj.eben(20,4);
  44.  
  45.  
  46.  
  47. return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement