• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Forcing subclass to override method (WITHOUT USING ABSTRACT)

#1
[eluser]blasto333[/eluser]
Ok this might sound like an odd example where I want to force a subclass to override a method of a base class (which has implementation)

I have a Person Model (Superclass)
* exists
* get_all

* get_info
* get_multiple_info
* save
* delete
* delete_list

Then the sub classes

Customer extends Person

Employee extends Person

I want subclasses to overwrite the methods in red, but I don't want to make the model abstract because I have a need to make Person objects to use methods such as get_info and get_multiple info (without knowing if I have a customer or employee)

Is there a way to do this besides just remembering?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.