OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.law/] [operators8.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do run  }
2
// GROUPS passed operators
3
#include 
4
 
5
class shape {
6
  public:
7
    virtual int vDisplay(void) const = 0;
8
  protected:
9
    int X;
10
    int Y;
11
};
12
 
13
class square :public shape {
14
  public:
15
    square(int x, int y, int width_) {
16
        X = x;
17
        Y = y;
18
        width = width_;
19
    }
20
    int vDisplay(void) const {
21
        printf ("PASS\n");
22
        return 0;
23
    }
24
  protected:
25
    int width;
26
};
27
 
28
 
29
class triangle :public shape {
30
  public:
31
    triangle(int x, int y, int width_, int height_) {
32
        X = x;
33
        Y = y;
34
        width = width_;
35
        height = height_;
36
    }
37
    int vDisplay(void) const {
38
        printf ("FAIL\n");
39
        return 1;
40
    }
41
  protected:
42
    int width;
43
    int height;
44
};
45
 
46
int main() {
47
    shape* s1 = new square(4,4,5);
48
    shape* s2 = new triangle(6,6,2,3);
49
    *s1 = *s2;
50
    return s1->vDisplay();
51
}
52
 

powered by: WebSVN 2.1.0

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