repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
FSF GCC merge 02/23/03
[official-gcc.git]
/
gcc
/
testsuite
/
g++.old-deja
/
g++.law
/
virtual4.C
blob
0254fda6ab9809af8c5332d334b5f6991f38a793
1
// GROUPS passed virtual-functions
2
#include <stdio.h>
3
#include <stdlib.h>
4
5
int aset = 0;
6
class A
7
{
8
public:
9
void Set() { SetProp(); }
10
virtual void SetProp() { aset++;}
11
};
12
13
class B:public A
14
{
15
public:
16
void SetProp() { if (!aset) { printf ("FAIL\n"); exit (1);} aset--;}
17
};
18
19
int main()
20
{
21
A a;
22
B b;
23
A *c=new A;
24
A *d=new B;
25
26
a.Set();
27
b.Set();
28
c->Set();
29
d->Set();
30
printf ("PASS\n");
31
}