The Light and Fan are two different vendor classes and they are not derived from any base class.
I am trying to implement the Command design pattern but with generic implementation, so it should work in future with any new vendor class like Door, Window etc without much change in client code. I have thought about a Factory method but it will not work because it needs a Base class.

It is not an assignment; I am trying to learn the design patterns.

Light *myobj;
Fan *myobj;
int choice;
cout<<"Select Light (1): ";
cout<<"Select Fan (2): ";
cin>>choice;

if (choice ==1){
Light *myobj = new Light();
}
if (choice ==2){
Fan *myobj = new Fan();
}

FlipUpCommand switchUp(*myobj);




Error:conflicting declaration 'Fan*myobj'