[ create a new paste ] login | about

Link: http://codepad.org/tVyG4yyv    [ raw code | output | fork ]

C++, pasted on Jan 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
using namespace std;

class A {
public:
  virtual string foo(){return "A::foo";}
};

class B : public A {
public:
  virtual string foo(){return "B::foo";}
};

int main () {
  B* b = new B();
  // In my opinion the following sould not be allowed
  cout << b->A::foo() << endl;  // Will print "A::foo"
}


Output:
1
A::foo


Create a new paste based on this one


Comments: