CodeIgniter Forums
Forcing subclass to override method (WITHOUT USING ABSTRACT) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Forcing subclass to override method (WITHOUT USING ABSTRACT) (/thread-12431.html)



Forcing subclass to override method (WITHOUT USING ABSTRACT) - El Forum - 10-19-2008

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