[ create a new paste ] login | about

Link: http://codepad.org/Lrswof7O    [ raw code | output | fork ]

C++, pasted on Aug 15:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
using namespace std;

class myclass {
  static int i;
public:
  void seti(int n) { i = n; }
  int geti() { return i; }
};

int main()
{
  myclass o1, o2;
  o1.seti(10);
  cout << "o1.i" << o1.geti() << endl;
  cout << "o2.i" << o2.geti() << endl;
  return 0;
}
/* end */


Output:
1
2
3
In function `main':
undefined reference to `myclass::i'
undefined reference to `myclass::i'


Create a new paste based on this one


Comments: