Adobe Interview Question
Member Technical StaffsCountry: India
Interview Type: In-Person
we can use command pattern here.
we create separate class of each button. All those are derived from single base class having virtual execute() function.
since there is polymorphism on execution of button press, so no need of conditional statements.
Also in command pattern we can queue the button press function.
We can use array of function pointers.
- Rachit Singhal March 27, 2014Suppose for key 1 we want to call func1(). then
a[1]=*func1();
Now when a function is hit with some key i then we simply need to call a[i]. it will automatically call the function.