mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
50 lines
873 B
C++
50 lines
873 B
C++
/****************************************************************
|
|
****
|
|
**** This file belongs with the course
|
|
**** Introduction to Scientific Programming in C++/Fortran2003
|
|
**** copyright 2016-2023 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
****
|
|
**** default.cxx : defaulted default constructors
|
|
****
|
|
****************************************************************/
|
|
|
|
#include <iostream>
|
|
using std::cin;
|
|
using std::cout;
|
|
|
|
//codesnippet defaultno
|
|
class IamOne {
|
|
private:
|
|
int i=1;
|
|
public:
|
|
void print() {
|
|
cout << i << '\n';
|
|
};
|
|
};
|
|
//codesnippet end
|
|
|
|
|
|
class Point {
|
|
private:
|
|
double x,y;
|
|
public:
|
|
//codesnippet defaulteddefault
|
|
Point() = default;
|
|
Point( double x,double y )
|
|
: x(x),y(y) {};
|
|
//codesnippet end
|
|
};
|
|
|
|
int main() {
|
|
|
|
//codesnippet defaultno
|
|
IamOne one;
|
|
one.print();
|
|
//codesnippet end
|
|
|
|
Point x;
|
|
Point y(1.2,3.4);
|
|
|
|
return 0;
|
|
}
|