Assuming I have to handle the adding, editing or deleting of something.
Is better to create three class like:
class AddSomething{}
class DeleteSomething{}
class EditSomething{}
or a class with three methods like:
class Something{
public function add(){}
public function delete(){}
public function edit(){}
}
Another alternative is abstract class, but these three functionality have very little in common, such as add and remove (practically nothing).
What is the best alternative according to the rules of OOP?
Aucun commentaire:
Enregistrer un commentaire