I’m a PHP programmer by default, and I need a little help with a C# .NET (Micro Frameworks, but that doesn’t matter here) project.
Basically, I have a class that allows for control of an RC car or airplane speed controller. The class is already written, but I need a way to import settings into the class, since diffident electric speed controllers require different settings.
My ideal set up would be something like this:
SpeedController esc = new SpeedController(SpeedControllers.TRAXXAS_XL5);
I know how the constructor and all that work, but how do I configure the SpeedControllers.TRAXXAS_XL5 part? I would create a base class (Speedcontrollers) and then a class that extends it, overriding the default values, correct?
Can someone direct me to a tutorial on what I am talking about or a small code snippet of a child class overriding properties in a parent class?
I’ll just take an example using a hypothetical
MaxSpeedthe conroller might have.Then in your SpeedController constructor
Call it with
new SpeedController(new SpeedControllers.TRAXXAS_XL5())