URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 154 |
Rev 816 |
// { dg-do run }
|
// { dg-do run }
|
// GROUPS passed operators
|
// GROUPS passed operators
|
#include
|
#include
|
|
|
class shape {
|
class shape {
|
public:
|
public:
|
virtual int vDisplay(void) const = 0;
|
virtual int vDisplay(void) const = 0;
|
protected:
|
protected:
|
int X;
|
int X;
|
int Y;
|
int Y;
|
};
|
};
|
|
|
class square :public shape {
|
class square :public shape {
|
public:
|
public:
|
square(int x, int y, int width_) {
|
square(int x, int y, int width_) {
|
X = x;
|
X = x;
|
Y = y;
|
Y = y;
|
width = width_;
|
width = width_;
|
}
|
}
|
int vDisplay(void) const {
|
int vDisplay(void) const {
|
printf ("PASS\n");
|
printf ("PASS\n");
|
return 0;
|
return 0;
|
}
|
}
|
protected:
|
protected:
|
int width;
|
int width;
|
};
|
};
|
|
|
|
|
class triangle :public shape {
|
class triangle :public shape {
|
public:
|
public:
|
triangle(int x, int y, int width_, int height_) {
|
triangle(int x, int y, int width_, int height_) {
|
X = x;
|
X = x;
|
Y = y;
|
Y = y;
|
width = width_;
|
width = width_;
|
height = height_;
|
height = height_;
|
}
|
}
|
int vDisplay(void) const {
|
int vDisplay(void) const {
|
printf ("FAIL\n");
|
printf ("FAIL\n");
|
return 1;
|
return 1;
|
}
|
}
|
protected:
|
protected:
|
int width;
|
int width;
|
int height;
|
int height;
|
};
|
};
|
|
|
int main() {
|
int main() {
|
shape* s1 = new square(4,4,5);
|
shape* s1 = new square(4,4,5);
|
shape* s2 = new triangle(6,6,2,3);
|
shape* s2 = new triangle(6,6,2,3);
|
*s1 = *s2;
|
*s1 = *s2;
|
return s1->vDisplay();
|
return s1->vDisplay();
|
}
|
}
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.