java - How to call base class method? -


Say that I have declared class like this:

  public intangible class identifiable distance { Public boolean valid () {back true; }} Public Class Preference Indicator Eligibility Provides {Public Boolean Valid () {Back to Truth; Now, suppose I have PreferenceCategory variable, and I want to call identifier affiliation. Validity () method, PreferenceCategory.validate ()  No   

method.

I would have thought that I can do this with an artist (see below), but it still calls the override method:

  PreferenceCategory cat = new PreferenceCategory (); // like this call PreferenceCategory.validate (), not what I want ((IdentifiableEntity) cat). Validate ();  

Is there any way to do this?

You can not Your best bet is to add another method to PreferenceCategory which calls the valid () method of Super.

  Validate public booleanSuper () {return super .validate (); }  

But why would you like to do this? It's a little design odor you can find interesting.


Comments