I am wondering if it's possible to explicitly access a super class method in Java outside of the derived class. The following C++ code illustrates this:
#include <iostream>
using namespace std;
class A {
public:
virtual void f( ) {
cout << "A\n";
}
};
class B : public A {
public:
void f( ) {
cout << "B\n";
}
};
int main( ) {
B b;
b.A::f( );
return 0;
}
This code outputs "A" because it calls the A version of f explicitly.
I know this is horrible design, and totally breaks encapsulation, but is this possible in Java?