I created a few classes that represent Commands to my car:
PaintCommand.RefuelCommand.
This classes implemented ICommand Interface, Contain Execute(Car c) method.
Example:
public class RefuelCommand : ICommand
{
public RefuelCommand()
{
}
public void Execute(Car car)
{
car.SetFuel(100);
}
}
I used command patterns to init the commands.
Now, i want to be able to add new Command without change the code.
Assume i want now Change Name command
Does anyone have an idea?
My Idea:
Create a xml file that describe the class command. (Name, Param) and generate from it a new Command object.
Aucun commentaire:
Enregistrer un commentaire