CodeIgniter Forums

Full Version: Forcing subclass to override method (WITHOUT USING ABSTRACT)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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?