mirror of
https://github.com/VictorEijkhout/TheArtOfHPC_vol3_cppf08programming.git
synced 2026-01-24 22:44:48 +09:00
39 lines
797 B
C++
39 lines
797 B
C++
/****************************************************************
|
|
****
|
|
**** This file belongs with the course
|
|
**** Introduction to Scientific Programming in C++/Fortran2003
|
|
**** copyright 2016-8 Victor Eijkhout eijkhout@tacc.utexas.edu
|
|
****
|
|
**** pointstruct.cxx : OOP stuff with a struct
|
|
****
|
|
****************************************************************/
|
|
|
|
#include <iostream>
|
|
using std::cin;
|
|
using std::cout;
|
|
|
|
//codesnippet structobj
|
|
struct object {
|
|
~object() { cout << "bye bye" << '\n'; }
|
|
};
|
|
struct point : public object {
|
|
double x; double y;
|
|
double xpp() { x = x+1; return x; };
|
|
point() { x = 1; };
|
|
} ;
|
|
//codesnippet end
|
|
|
|
int main() {
|
|
|
|
{
|
|
struct point p1;
|
|
|
|
cout << p1.xpp() << '\n';
|
|
cout << p1.xpp() << '\n';
|
|
cout << p1.xpp() << '\n';
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|