template

 avatar
unknown
c_cpp
2 years ago
399 B
3
Indexable
#include<bits/stdc++.h>
using namespace std;
///
template<typename T>
class Moctor{
    T a, b;
public:
    Moctor(T x, T y)
    {
        a = x;
        b = y;
    }
    T mou()
    {
        return a+b;
    }
    T shakil()
    {
        return a-b;
    }

};



int main()
{
    Moctor<double>m(2.9, 5.5);
    cout<<m.mou()<<endl;
    cout<<m.shakil()<<endl;

}

Editor is loading...