two inherits in one class 
Author Message
 two inherits in one class

One of my classes inherits from Inherits System.Collections.DictionaryBase
But I want this class also Inherits from System.Windows.Forms.Button.
How can I do this. The help says only, that I can inherit only from
one time.

Best regards,
FAUSER AG
Marc Fauser

........................................................
FAUSER AG

Gutenbergstr. 5
82205 Gilching

Fon:    +49 (0)8105 / 26790
Fax:    +49 (0)8105 / 26797
Web:   http://www.*-*-*.com/
........................................................

[gem. Par.28Abs.3 BDSG ist die Verwendung der Adresse fr Werbung untersagt]



Sat, 27 Nov 2004 20:17:21 GMT  
 two inherits in one class
Multiple inheritance is not supported. A workaround is to inherit from a
single class and implements an interface for the second class that you want
to inherit. For the implementation of the interface you can use containment
and delegation (as in the VB6 way of doing things).

--
Best regards,

Carlos J. Quintero

MZ-Tools 3.0 freeware 'all-in-one' Add-In for VB5, VB6 and VBA:
Find and Replace All, Code Templates, Detect Dead Code, TabIndex Assistant,
External Utilities, XML Documentation,  Private Clipboards, Statistics, Sort
Procedures and up to 40+ features:
www.mztools.com


Quote:
> One of my classes inherits from Inherits System.Collections.DictionaryBase
> But I want this class also Inherits from System.Windows.Forms.Button.
> How can I do this. The help says only, that I can inherit only from
> one time.

> Best regards,
> FAUSER AG
> Marc Fauser



Sat, 27 Nov 2004 20:41:28 GMT  
 two inherits in one class

Quote:
> Multiple inheritance is not supported. A workaround is to inherit
> from a single class and implements an interface for the second class
> that you want to inherit. For the implementation of the interface you
> can use containment and delegation (as in the VB6 way of doing
> things).

I want to inherit my class from a button and from a dictionarybase.
So as you suggested, I would inherit from dictionarybase and make
my interface with delegations to my button?

Marc



Sat, 27 Nov 2004 20:59:55 GMT  
 two inherits in one class

Quote:

> I want to inherit my class from a button and from a dictionarybase.
> So as you suggested, I would inherit from dictionarybase and make
> my interface with delegations to my button?

Just to satisfy my curiosity, why you would want to inherit from both of
these classes?

--
Jacob Grass
Microsoft .NET MVP
Check out http://windowsforms.net



Sun, 28 Nov 2004 00:53:35 GMT  
 two inherits in one class
Marc,
In addition to Jacob's question:

Actually I would strongly suggest you:
- Inherit from Button
- Implement System.Collections.IDictionary
- Delegating to a System.Collections.Hashtable.

Hope this helps
Jay


Quote:

> > Multiple inheritance is not supported. A workaround is to inherit
> > from a single class and implements an interface for the second class
> > that you want to inherit. For the implementation of the interface you
> > can use containment and delegation (as in the VB6 way of doing
> > things).

> I want to inherit my class from a button and from a dictionarybase.
> So as you suggested, I would inherit from dictionarybase and make
> my interface with delegations to my button?

> Marc



Sun, 28 Nov 2004 09:56:40 GMT  
 two inherits in one class
I would do the opposite: inherit from the button class and implement the
dictionarybase, because it has more logical sense for me.

--
Best regards,

Carlos J. Quintero

MZ-Tools 3.0 freeware 'all-in-one' Add-In for VB5, VB6 and VBA:
Find and Replace All, Code Templates, Detect Dead Code, TabIndex Assistant,
External Utilities, XML Documentation,  Private Clipboards, Statistics, Sort
Procedures and up to 40+ features:
www.mztools.com


Quote:

> I want to inherit my class from a button and from a dictionarybase.
> So as you suggested, I would inherit from dictionarybase and make
> my interface with delegations to my button?



Sun, 28 Nov 2004 17:40:44 GMT  
 two inherits in one class



Quote:

> > I want to inherit my class from a button and from a dictionarybase.
> > So as you suggested, I would inherit from dictionarybase and make
> > my interface with delegations to my button?

> Just to satisfy my curiosity, why you would want to inherit from both of
> these classes?

For the same reason you'd breed an elephant and a rhino.

Elephino.

Personally, I could really use a
DictionaryBaseComboBoxMDIFormSerialCommPrinterNetworkHashtableStringTimer class.

Seriously though, using inheritance in the manner described by the original post
is a form of the "UsingInheritanceFromAUtilityClass" and
"UsingInheritanceForComposition" antipatterns.



Mon, 29 Nov 2004 15:07:12 GMT  
 two inherits in one class
anyone have any images of these elepharhinos in the wild?



Quote:
> I would do the opposite: inherit from the button class and implement the
> dictionarybase, because it has more logical sense for me.

> --
> Best regards,

> Carlos J. Quintero

> MZ-Tools 3.0 freeware 'all-in-one' Add-In for VB5, VB6 and VBA:
> Find and Replace All, Code Templates, Detect Dead Code, TabIndex
Assistant,
> External Utilities, XML Documentation,  Private Clipboards, Statistics,
Sort
> Procedures and up to 40+ features:
> www.mztools.com



> > I want to inherit my class from a button and from a dictionarybase.
> > So as you suggested, I would inherit from dictionarybase and make
> > my interface with delegations to my button?



Sat, 25 Dec 2004 22:20:08 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Problem with a vb.Net class inheriting from a c# class

2. nested class inherits containing class accessing private instance members

3. TWO PROJECTS, TWO EXE'S, ONE INSTALL???

4. Two Winsocks on two adapters on one machine?

5. Identifying Inherited Classes Properties and Methods seperately form inheriting classes P's and M's

6. Two Virtually Identical Modules, One Works, One doesn't

7. Two similar templates--one works one doesn't

8. Two Questions, one simple, one not so!

9. Two questions... one easy, one hard

10. Merge two wave file one after one

11. DataGrid remove item error bind with own class inherit from collection

12. DataGrid remove item error bind with own class inherit from collection

 

 
Powered by phpBB® Forum Software