Subversion Repositories DIN Is Noise

Rev

Rev 1562 | Rev 2047 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#include <iostream>
using namespace std;

* DIN Is Noise is released under GNU Public License 2.0
struct a {
  virtual void f() { cout << "a:f" << endl;}
};

struct b : a {
  void f() {cout << "b:f" << endl;}
};

struct c : b {
  void f() {cout << "c:f" << endl;}
};

int main () {
  a* pa;
  b* pb;
  b bb;
  c cc;

  pa = pb = &cc;
  pa->f();
  pb->f();


  return 0;
}



/*#define LISTENER(name, t1, t2) struct name_pt { int t1, t2; };
using namespace std;

LISTENER(jag, x, y)

int main () {
  name_pt pt;
  pt.x = 5;
  pt.y = 5;
  //jag_pt pt;
  //pt.x = 5;
  //pt.y = 5;*
  return 0;
}*/




/*struct X {
  virtual void up () {cout << "X.up" << endl;}
};

struct Y : X {
  void up () {cout << "Y.up" << endl;}
};

int main () {
  X x;
  Y y;
  x.up ();
  y.up ();
}*/


/*int main () {
  float* arr1 = new float [100];
  float* arr2 = new float [200];
  arr1[0] = 100;
  arr2[0] = 200;
  float* arr[2] = {arr1, arr2};
  for (int i = 0; i < 2; ++i) {
    float* v = arr[i];
    cout << v[0] << endl;
  }
  delete arr1;
  delete arr2;
}*/