Hi all,
OK, I'm trying to find out whether or not this is possible. What I want to do is have a general class where a basic list of methods are predefined, let's say "Car." Car will have the "Start" method, the "Accelerate" method, and the "Turn lights on" method.
Now, I want all instances of Car to have the same basic methods, however, when I instantiate a particular instance of car I want to override the "Turn lights on" method with a more complicated method that checks other factors.
Now, if I was going to make a whole class of these cars that have a different way of checking the "Turn lights on" method, I would make a class and inherit from Car. However, I am only going to make one with that particular difference. I will be making a multitude of these "almost-cars" that share, for the most part, the same methods and implamentation. However, none of the methods will always be the same, and all of them could change slightly instance to instance.
Is there a way, at instantiation, to override the standard method in the class? Something like:
Dim SpyCar as Car
SpyCar = New Car
Override SpyCar.TurnLightsOn()
I know that probably looks nothing like the actual syntax would (if there even is a syntax for this), but I've put it there just to give you an idea of what I'm thinking.
Thanks very much,
Joshua Wise
OK, I'm trying to find out whether or not this is possible. What I want to do is have a general class where a basic list of methods are predefined, let's say "Car." Car will have the "Start" method, the "Accelerate" method, and the "Turn lights on" method.
Now, I want all instances of Car to have the same basic methods, however, when I instantiate a particular instance of car I want to override the "Turn lights on" method with a more complicated method that checks other factors.
Now, if I was going to make a whole class of these cars that have a different way of checking the "Turn lights on" method, I would make a class and inherit from Car. However, I am only going to make one with that particular difference. I will be making a multitude of these "almost-cars" that share, for the most part, the same methods and implamentation. However, none of the methods will always be the same, and all of them could change slightly instance to instance.
Is there a way, at instantiation, to override the standard method in the class? Something like:
Dim SpyCar as Car
SpyCar = New Car
Override SpyCar.TurnLightsOn()
I know that probably looks nothing like the actual syntax would (if there even is a syntax for this), but I've put it there just to give you an idea of what I'm thinking.
Thanks very much,
Joshua Wise