I have a super class: SuperClass (for simplicity).
I also have 2 classes that sublcass this SuperClass: SubclassA and SubclassB.
Assuming I have the following method:
Based on this, will all the objects ONLY be SuperClass objects and only available to use SuperClass methods, etc?Code:..... public SuperClass getObj(String name, Date create){ SuperClass obj; if(name == "blah"){ return obj = new SubclassA(); } //if create date after some other date if(create.After(new Date(1232341324) ){ return obj = new SubclassB(); } //else return obj = new SuperClass(); } .....
Or, if the first or second if statement is executed, the returned object from this method will have access to the methods defined in the subclass?
Thanks!


Reply With Quote


Bookmarks