File: gclass-test.cc

package info (click to toggle)
openc%2B%2B 2.5.3-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 3,268 kB
  • ctags: 7,251
  • sloc: cpp: 30,583; ansic: 16,718; makefile: 336; asm: 209; tcl: 126; sh: 3
file content (42 lines) | stat: -rw-r--r-- 599 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

#include <iostream.h>

metaclass GraphClass;

class Receiver {
public:
  Receiver() { compt=0; }
  void Inc() { compt++; cout << compt << endl; }
private:
  int compt;
};

class Sender {
public:
  Sender() { receiver=new Receiver(); }
  void Notify() { receiver->Inc(); }
private:
  Receiver *receiver;
};

class EmptyClass {
public:
  EmptyClass() { }
  int foo() { return 0; }
  int bar() { return 1; }
private:
  int i;
protected:
  float unused;
};


void main()
{
    Sender s;
    cout << "**** Notify ****" << endl;
    s.Notify();
    cout << "**** Notify ****" << endl;
    s.Notify();
}