OSDN Git Service

/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.law / operators8.C
1 // { dg-do run  }
2 // GROUPS passed operators
3 #include <stdio.h>
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