Merge pull request 'fixed errors' (#1) from eternal-will/ooplab:master into master

Reviewed-on: #1
This commit is contained in:
2022-12-27 08:08:04 +00:00

View File

@@ -2,27 +2,30 @@
using namespace std;
template <typename T,
typename = std::enable_if_t<std::is_arithmetic<T>::value, T>>
class Foo {
T x, y;
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 << "x: ";
cin >> x;
cout << "y: ";
cin >> y;
}
~Foo() { cout << "Destructor called, nothing to do here."; }
~Foo() { cout << "Destructor called, nothing to do here."; }
T mx() { return (x > y ? x : y); };
T mx() { return (x > y ? x : y); };
};
int main() {
Foo<float> bar;
int main()
{
Foo<float> bar;
cout << bar.mx() << endl;
cout << bar.mx() << endl;
return 0;
return 0;
}