473,809 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Forced Override question?

I am trying to build an interface that requires the developer to use the
OVERRIDE option. I looked at abstract classes, but seemed to have a couple
of problems:

1. If you do this in a form, it appears that I can't get the designer to
display the derived forms
2. It forces the override in the derived form (form A), but if another form
(form B) derives from this derived form (form A), it isn't forced to
override the method.

Basically, I have the following:

Form A -> Form B -> Form C -> Form D
I want Form D to HAVE to implement a method called RefreshScreen() with the
override option.

Any thoughts on how I can do this? Form A is the base form that has a
RefreshScreen() method in it.

I have also tried to build an interface, and it requires the developer to
implement the RefreshScreen() method, but they don't have to OVERRIDE it,
and if they don't, then one of the base forms RefreshScreen() method gets
called.

Mark
Nov 16 '05 #1
2 1330
I'm trying to understand just which design pattern would recommend that you
create an inheritance tree that is four concrete classes deep!

Instead of having D inherits C inherits B inherits A, why not have:
A, B, C, and D inherits Form and interface XX

The use one of the Gang-of-four patterns to derive the functionality you
want.
See http://home.earthlink.net/~huston2/dp/patterns.html (Probably my
favorite intro link for design patterns, but there are thousands... Google
"Design Patterns" )

Good luck,

--- Nick
"Mark Essex" <me****@nospam. netalytics.com> wrote in message
news:es******** ******@TK2MSFTN GP10.phx.gbl...
I am trying to build an interface that requires the developer to use the
OVERRIDE option. I looked at abstract classes, but seemed to have a couple of problems:

1. If you do this in a form, it appears that I can't get the designer to
display the derived forms
2. It forces the override in the derived form (form A), but if another form (form B) derives from this derived form (form A), it isn't forced to
override the method.

Basically, I have the following:

Form A -> Form B -> Form C -> Form D
I want Form D to HAVE to implement a method called RefreshScreen() with the override option.

Any thoughts on how I can do this? Form A is the base form that has a
RefreshScreen() method in it.

I have also tried to build an interface, and it requires the developer to
implement the RefreshScreen() method, but they don't have to OVERRIDE it,
and if they don't, then one of the base forms RefreshScreen() method gets
called.

Mark

Nov 16 '05 #2
Thanks, I will check out the link. To explain a little more of WHY I am
doing it this way:

I have a Framework I built which is pretty generic. It provides an SDI
style interface, which includes handling of all forms in the SDI interface.
This is Level 1 (SDIChildForm). I then have an Application built on top of
that. There are application-specific things that have nothing to do with
the more generic framework (ex. Patient handling), so I have a base form
(AppSDIChildFor m) that inherits from the SDIChildForm, and adds additional
methods, properties, etc. that are app-specific. Now, both of these forms
are just blank forms with some common methods and properties that interact
with the SDI framework. That's it. Next I have, for example, a Base 'Edit'
form (BaseEditForm), which is a specific 'form style' that I am using for
several of my forms in the application. It contains as much implementation
detail as possible about a specific form style (This is Level 3). I then
have specific forms that inherit from this Level 3 form to provide
application specific information.

Basically, the framework will call, for example, a RefreshScreen() method
whenever a specific form becomes the active form. Depending on the form,
the implementation of the RefreshScreen() is specific to that form. I need
to handle the refresh for each form differently. However, I want the main
framework to handle the RefreshScreen() call whenever appropriate. If the
RefreshScreen() method is overriden, then it will call the app-specific form
refresh at the appropriate time. This works well...I am just trying to
enforce that the Developer building the forms HAS to override to ensure
proper refresh on each form.

Make sense or am I off the wall here?

Thanks again,

Mark

"Nick Malik" <ni*******@hotm ail.nospam.com> wrote in message
news:s0Jyc.1790 0$eu.1366@attbi _s02...
I'm trying to understand just which design pattern would recommend that you create an inheritance tree that is four concrete classes deep!

Instead of having D inherits C inherits B inherits A, why not have:
A, B, C, and D inherits Form and interface XX

The use one of the Gang-of-four patterns to derive the functionality you
want.
See http://home.earthlink.net/~huston2/dp/patterns.html (Probably my
favorite intro link for design patterns, but there are thousands... Google
"Design Patterns" )

Good luck,

--- Nick
"Mark Essex" <me****@nospam. netalytics.com> wrote in message
news:es******** ******@TK2MSFTN GP10.phx.gbl...
I am trying to build an interface that requires the developer to use the
OVERRIDE option. I looked at abstract classes, but seemed to have a

couple
of problems:

1. If you do this in a form, it appears that I can't get the designer to
display the derived forms
2. It forces the override in the derived form (form A), but if another

form
(form B) derives from this derived form (form A), it isn't forced to
override the method.

Basically, I have the following:

Form A -> Form B -> Form C -> Form D
I want Form D to HAVE to implement a method called RefreshScreen() with

the
override option.

Any thoughts on how I can do this? Form A is the base form that has a
RefreshScreen() method in it.

I have also tried to build an interface, and it requires the developer to implement the RefreshScreen() method, but they don't have to OVERRIDE it, and if they don't, then one of the base forms RefreshScreen() method gets called.

Mark


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4760
by: Harry | last post by:
CSS Description: Table contains a column of td cells with links. Achieved: 1. Entire link cells highlight when hovered. 2. The entire area of these cells are clickable. Problem:
11
19462
by: z_learning_tester | last post by:
Hello, yes another beginner question that I'm sure is obvious to many here :-) My book is so bad. Really. It uses the exact same example of code for using the new kw and for using virtual(in the base class) then override(in the derived class), but fails to compare and contrast the two... I've read this (short snippet)three times and by the looks of it they both do exactly the same thing- allow you to derive from the base and save...
15
2555
by: John Salerno | last post by:
Hi all. I have a question about virtual and override methods. Please forgive the elementary nature! First off, let me quote Programming in the Key of C#: "Any virtual method overridden with 'override' remains a virtual method for further descendent classes." Now here's my question: Let's say you have base class A, and subclasses B and C. Class A contains a virtual method, and B contains an override method. If C didn't have an...
5
5295
by: fbwhite | last post by:
I know this issue has been brought up many times, but I have tried many of the solutions to no avail. I wanted to give my specific case to see if someone could be of any help. We are using the sessionstate inproc mode and users are randomly losing their session. I do not believe it is happening across all users at one time. It seems to happen to different users at different times, but I am only going off heresay. The aspnet worker...
0
9601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10378
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.