Files
ooplab/lab9/26.cpp
2022-12-27 05:09:23 +00:00

31 lines
452 B
C++

#include <iostream>
using namespace std;
template <typename T,
typename = enable_if<is_arithmetic<T>::value, T>>
class Foo
{
T x, y;
public:
Foo()
{
cout << "x: ";
cin >> x;
cout << "y: ";
cin >> y;
}
~Foo() { cout << "Destructor called, nothing to do here."; }
T mx() { return (x > y ? x : y); };
};
int main()
{
Foo<float> bar;
cout << bar.mx() << endl;
return 0;
}