Merge pull request 'fixed errors' (#1) from eternal-will/ooplab:master into master
Reviewed-on: #1
This commit is contained in:
11
lab9/26.cpp
11
lab9/26.cpp
@@ -2,12 +2,14 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
template <typename T,
|
template <typename T,
|
||||||
typename = std::enable_if_t<std::is_arithmetic<T>::value, T>>
|
typename = enable_if<is_arithmetic<T>::value, T>>
|
||||||
class Foo {
|
class Foo
|
||||||
|
{
|
||||||
T x, y;
|
T x, y;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Foo() {
|
Foo()
|
||||||
|
{
|
||||||
cout << "x: ";
|
cout << "x: ";
|
||||||
cin >> x;
|
cin >> x;
|
||||||
cout << "y: ";
|
cout << "y: ";
|
||||||
@@ -19,7 +21,8 @@ public:
|
|||||||
T mx() { return (x > y ? x : y); };
|
T mx() { return (x > y ? x : y); };
|
||||||
};
|
};
|
||||||
|
|
||||||
int main() {
|
int main()
|
||||||
|
{
|
||||||
Foo<float> bar;
|
Foo<float> bar;
|
||||||
|
|
||||||
cout << bar.mx() << endl;
|
cout << bar.mx() << endl;
|
||||||
|
Reference in New Issue
Block a user