OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [virtual4.C] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do run  }
2
// GROUPS passed virtual-functions
3
#include 
4
#include 
5
 
6
int aset = 0;
7
class A
8
{
9
  public:
10
    void Set() { SetProp(); }
11
    virtual void SetProp() { aset++;}
12
};
13
 
14
class B:public A
15
{
16
  public:
17
    void SetProp() { if (!aset) { printf ("FAIL\n"); exit (1);} aset--;}
18
};
19
 
20
int main()
21
{
22
    A a;
23
    B b;
24
    A *c=new A;
25
    A *d=new B;
26
 
27
    a.Set();
28
    b.Set();
29
    c->Set();
30
    d->Set();
31
    printf ("PASS\n");
32
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.