mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-27 14:50:23 +00:00
21 lines
262 B
C++
21 lines
262 B
C++
class foo {
|
|
char z [10];
|
|
public:
|
|
virtual char *get_z () { return & this->z[0]; }
|
|
};
|
|
|
|
class bar: public foo {
|
|
char q [20];
|
|
public:
|
|
char *get_z () { return & this->q[0]; }
|
|
};
|
|
|
|
int main () {
|
|
foo *x = new bar ();
|
|
|
|
x->get_z()[9] = 'a';
|
|
|
|
delete x;
|
|
return 0;
|
|
}
|