Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Override custom method in subclass
Message
From
08/09/2009 16:45:17
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
08/09/2009 12:45:40
John Baird
Coatesville, Pennsylvania, United States
General information
Forum:
ASP.NET
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
01423040
Message ID:
01423171
Views:
44
>>
>>The question above has to do with overriding a method and still calling the base code that goes with it. There are at least a couple of ways to do this; one of which was shown by Gregory. One method you can't just completely override is the constructor but it is easy to get around that. Put your code in a different method of the base class and then call that method from the constructor. Then you can override that different method in your subclass. oh, I digressed; sorry. Bottom line if you can't override methods then we would really be up a creek for oop.
>>Tim
>
>
>You can always chain constructors for different behavior also.

Yes, it is a good thing when you need it and plan it right. I do find it challenging sometimes to figure out which one is running first. It is kind of like ASP page events, you have to be careful what happens before the other.

About this thread though; I am thinking this thread confusing over semantics. I consider a class to be the blueprint for creating an instance(s) of it. I don't understand all this talk of adding code to an instance. Another class based on the first is not an instance but a subclass. That is why we reference variables in the instance with "this". You can't add code to an instance of a running form class (well maybe if you are tricky). If you add a textbox to a form (class), what is the textbox? I wouldn't think it would be an instance until it is running along with all the other controls on the form. The only thing added to the form really is code, to add an instance of the textbox(s) to the instance of the form.
Tim
Timothy Bryan
Previous
Reply
Map
View

Click here to load this message in the networking platform