Method overloading: Adding parameters


I have a class with a constructor, and a subclass.
The conctructor of the subclass is very similar as that from the base class. Only with some parameters and code added. Can I extend the constructor of the base class with extra parameters?

Base class: Vehicle(c As Color)
Subclass: Car(c As Color, numberOfWheels As Integer)

Is there a way to only implement the numberOfWheels parameter in car?

What I want to archieve:

If the constructor of Vehicle changes to Vehicle(c As Color, width As Integer, height As Integer), I dont want to change ANY code on the Car subclass, is this possible?

Thank you

Yes. Just add a Constructor with your parameters to the subclass.

A good practice it so create a simple Constructor in your superclass that does basic setup. If the class may only be instantiated with parameters, you can make that Constructor private.

In your other Constructors, call the superclass’ simple Constructor. For example:

Sub Vehicle.Constructor (c As Color)
  // Other code
End Sub

Sub Car.Constructor (numberOfWheels As Integer)
  // Other code
End Sub

Sub Car.Constructor (c As Color, numberOfWheels As Integer)
   super.Constructor( c )
  // Other code
End Sub

Thanks again for the clear answer!