473,320 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

multiple inheritance alternative please.

I have a class "SomeForm" that inherits a "Global" class which in turn
inherits "System.Windows.Forms.Form". As you may have guessed all my
other classes that are inheriting from "Global" are also picking up on
the "Form" fudge. Since I only have one form in my app, it bothers me
that "Global" is so obese.

I would like to clean this up a little.
I was thinking of setting "Global" as an interface but i'm not sure how
I could maintain the staticness of my class.

I know global variables are frowned on but if I had to pass my global
object along everywhere... it would suck.

I also thought of singleton for my global class but felt it would be
awkward to set variables with.
I'm still not all that comfortable with OO and could use some input.
any objections to my approach appreciated.

V.

Nov 17 '05 #1
3 1365
"vidalsasoon" <kj*****@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have a class "SomeForm" that inherits a "Global" class which in turn
inherits "System.Windows.Forms.Form". As you may have guessed all my
other classes that are inheriting from "Global" are also picking up on
the "Form" fudge. Since I only have one form in my app, it bothers me
that "Global" is so obese.
Can you explain what you are trying to do.
I know global variables are frowned on but if I had to pass my global
object along everywhere... it would suck.


There's nothing wrong with using a global variable when appropriate.

Michael
Nov 17 '05 #2
vidalsasoon wrote:
I have a class "SomeForm" that inherits a "Global" class which in turn
inherits "System.Windows.Forms.Form". As you may have guessed all my
other classes that are inheriting from "Global" are also picking up on
the "Form" fudge. Since I only have one form in my app, it bothers me
that "Global" is so obese.

I would like to clean this up a little.
I was thinking of setting "Global" as an interface but i'm not sure how
I could maintain the staticness of my class.

I know global variables are frowned on but if I had to pass my global
object along everywhere... it would suck.

I also thought of singleton for my global class but felt it would be
awkward to set variables with.

You could easily create a static class to hold your globals which would
then function very similarly to a global in a bas module in vb6.

It does not sound like the global class inheriting from form is the
right way to go.

What "globals" do you need?

JB
I'm still not all that comfortable with OO and could use some input.
any objections to my approach appreciated.

V.

Nov 17 '05 #3
well i'll be damned.

All this time I thought we had to inherit from a base class to maintain
"persistence". This is gonna make things a lot easier.

xox.

Nov 17 '05 #4

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

Similar topics

14
by: Axel Straschil | last post by:
Hello! Im working with new (object) classes and normaly call init of ther motherclass with callin super(...), workes fine. No, I've got a case with multiple inherance and want to ask if this...
8
by: Shawn Casey | last post by:
Consider the following code: interface IBase { virtual void BaseFunction() = 0; }; interface IDerived : public IBase { virtual void DerivedFunction() = 0;
20
by: km | last post by:
Hi all, In the following code why am i not able to access class A's object attribute - 'a' ? I wishto extent class D with all the attributes of its base classes. how do i do that ? thanks in...
29
by: MAHESH MANDHARE | last post by:
Hi , Can Anyone explain me exactly why multiple inheritance not used in java and c# thanks, Mahesh -- Have A Good Day, Mahesh, Maheshmandhare@yahoo.co.in
8
by: **Developer** | last post by:
I have a control called MyPanel that inherits from Panel. Also a control called MyRTB that inherits from RichTextBox. They are used on a form as follows: MyPanel in on the form and MyRTF is...
47
by: Mark | last post by:
why doesn't .NET support multiple inheritance? I think it's so silly! Cheers, Mark
60
by: Shawnk | last post by:
Some Sr. colleges and I have had an on going discussion relative to when and if C# will ever support 'true' multiple inheritance. Relevant to this, I wanted to query the C# community (the...
2
by: weird0 | last post by:
Suppose i have two classes A and B: class A { public method_a(); } class B
3
by: Jess | last post by:
Hello, I've been reading Effective C++ about multiple inheritance, but I still have a few questions. Can someone give me some help please? First, it is said that if virtual inheritance is...
47
by: Larry Smith | last post by:
I just read a blurb in MSDN under the C++ "ref" keyword which states that: "Under the CLR object model, only public single inheritance is supported". Does this mean that no .NET class can ever...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.