473,659 Members | 2,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple Inheritance scenario

i'm a little confused as how to accomplish this

I have multiple actors in a timesheet system I am developing. Some of
the actors are: Administrator, Manager, Reviewer, DefaultUser, etc...
Now, all users inherit from DefaultUser, but I also want an
Administrator to inherit from a Reviewer. How would you accomplish
this?c# and vb do not support multiple inheritance. I was thinking
interfaces, but I am still cloudy on interfaces or abstract classes and
when to use each method.

Any help would be appreciated. Thank you

sean

Nov 29 '05 #1
6 1362
Dkode,

Yes Interfaces, however you can of course as well make

Actors
Defaultusers
SpecialUsers
Administrators
Reviewers

What is probably less work

Just my thought,

Cor
Nov 30 '05 #2
so if I use interfaces, I would re-coding correct? Since there is no
implementation in an interface, I would have to implement the
methods/properties in each class subscribing to the interface. This
seems like more work.

In your other example, would you use base classes? For instance:

Actors (Base Class)
DefaultUsers
SpecialUsers (Base Class)
Admins
Reviewers

is this what you meant?

Nov 30 '05 #3

Actors (Base Class)
DefaultUsers (inherits Actors)
SpecialUsers (inherits Actors)
Admins (inherits SpecialUsers)
Reviewers(inher its SpecialUsers)

is what I mean

:-)

Cor
Nov 30 '05 #4
I think that is exactly what I was looking for. Now that I am starting
to use interfaces and abstract classes in my apps, where can I find
good information on design patterns? I have read some articles and
design patterns at the Gang of Four website, but I dont really
understand how they work or when to use them. I guess the best thing to
do would be to get a book on design patterns. On the same note, would
learning about design patterns help out my class design?

Also in this example, I was reading about a Factory Class pattern where
you can have one class inherit from multiple base classes using a
Factory based approach. Is this something that would be beneficial to
me in this example?

I appreciate the advice. thanks

Sean

Nov 30 '05 #5
Hi Sean,

The best book IMO on design patterns (especially for beginners) is "Design
Patterns Explained" from Allan Shalloway and James Trott. Another very good
book in design patterns is "Patterns hatching" from John Vlissides.

As per your example it depends how you will be using classes. Factory
patterns is creational pattern meaning that it is used for creating objects.

hope this helps

Fitim Skenderi

"DKode" <dk****@gmail.c om> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
I think that is exactly what I was looking for. Now that I am starting
to use interfaces and abstract classes in my apps, where can I find
good information on design patterns? I have read some articles and
design patterns at the Gang of Four website, but I dont really
understand how they work or when to use them. I guess the best thing to
do would be to get a book on design patterns. On the same note, would
learning about design patterns help out my class design?

Also in this example, I was reading about a Factory Class pattern where
you can have one class inherit from multiple base classes using a
Factory based approach. Is this something that would be beneficial to
me in this example?

I appreciate the advice. thanks

Sean

Dec 1 '05 #6
Yesterday I ordered that book from Amazon. I saw alot of people
recommending it on the newsgroups, so I figure I would buy it.

thanks for the advice.

Dec 1 '05 #7

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

Similar topics

6
2827
by: Paul | last post by:
In real life situation, do we ever come across a situation where we would need two base objects in an object. A snippet is worth 1000 words (: so... class Base { }; class Derived1:public Base { };
22
23347
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete examples?
29
4651
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
7
1692
by: tshad | last post by:
I have a control that I am using from Metabuilders that requires you to use: <%@ Page Inherits="MetaBuilders.WebControls.DialogPage" %> How do I inherit my code-behind page or another object that may require an inherit also? Thanks, Tom
2
1854
by: Heinz Ketchup | last post by:
Hello, I'm looking to bounce ideas off of anyone, since mainly the idea of using Multiple Virtual Inheritance seems rather nutty. I chalk it up to my lack of C++ Experience. Here is my scenario... I have 5 Derived Classes I have 3 Base Classes
0
8330
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,...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8523
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,...
1
6178
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
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2749
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
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.