Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can code be inherited?
Message
From
25/04/2002 15:11:40
 
 
To
25/04/2002 13:02:29
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00649179
Message ID:
00649270
Views:
11
Mike, I might have an example for you. I have a subclass of the MSCOMM32.ocx in a library. In the control's oncomm event, I have the follwing as a template:
*** ActiveX Control Event ***
DO CASE
* Handle each event or error.
	* Events
	Case THIS.CommEvent = 1
		* SThreshold # of Characters to Transmit.
	Case THIS.CommEvent = 2
		* RThreshold # of characters Received.
	Case THIS.CommEvent = 3
		* Change in the CTS line.
	Case THIS.CommEvent = 4
		* Change in the DSR line.
	Case THIS.CommEvent = 5
		* Change in the CD line.
	Case THIS.CommEvent = 6
		* Change in the Ring Indicator.
	Case THIS.CommEvent = 7
		* An EOF character was found in the input stream.
	* Errors
	Case THIS.CommEvent = 1001  
		* A Break was received.
	Case THIS.CommEvent = 1002
		* CTS Timeout.
	Case THIS.CommEvent = 1003
		* DSR Timeout.
	Case THIS.CommEvent = 1004
		* Framing Error.
	Case THIS.CommEvent = 1006
		* Data Lost.
	Case THIS.CommEvent = 1007
		* CD (RLSD) Timeout.
	Case THIS.CommEvent = 1008
		* Receive buffer overflow.
	Case THIS.CommEvent = 1009
		* Parity Error.
	Case THIS.CommEvent = 1010
		* Transmit buffer full.
	Case THIS.CommEvent = 1011
		* Unexpected error retrieving DCB
ENDCASE
It would be nice to drag/drop an instance of the control on a form and now modify the behavior using the above 'empty' template.

>>I want may control autocopy all code from the parent class.
>
>Nope, the code isn't auto copied. Why would that be desirable, if youdon't mind me asking. The whole idea of inheritance is to create reusable, encaspulated code.
>
>If you wrote a routine in a class, and it copied itself, and you needed to make changes to that routine, you would have to fix that code in the class AND everywhere it was copied. The goal of inheritance is to make one change.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform