Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7515083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:41:22+00:00 2026-05-30T00:41:22+00:00

I have looked on line for information that would help me solve a design

  • 0

I have looked on line for information that would help me solve a design issue that is confusing me. I am new to complicated inheritance situations so my solution could actually just be rooted in a better design. But in trying to figure out what my design should be, I keep ending up thinking I really just need to inherit more than 1 base class.

My specific case involves Assets and different types of Assets.

Starting with the Asset…

Every PhysicalDevice is an Asset
Every VirtualDevice is an Asset
Every Server is an Asset

Every PhysicalServer would need to be both a PhysicalDevice and a Server
Every VirtualServer would need to be both a VirtualDevice and a Server
Every NetDevice is a PhysicalDevice
Every StorageArray is a PhysicalDevice

One solution I guess is to duplicate the Server code for both PhysicalServers, and VirtualServers however, I feel like this goes against what im trying to do, which is inherit.

They need to be separate classes because each of the types will have properties and methods. For instance, Server will have OSCaption, Memory, Procs, etc. PhysicalDevice will have things like Location, Serial, Vendor etc. And VirtualDevice will have a ParentDevice, State, VHDLocation etc.

If the inheritance is liner then i run into the problem of not being able to describe these types accurately.

Something that seems intriguing is Interfaces. It seems that i can define all base classes as interfaces and implement them in my main classes as needed. but, I am simply unsure of what the implications are if I were to do that.

for instance, something like… PhysicalServer : IAsset : IServer : IPhysical

I am in deep water so I’m really just looking for suggestions or guidance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T00:41:24+00:00Added an answer on May 30, 2026 at 12:41 am

    Interfaces are an appropriate way of ensuring contract integrity across types, but you may end up with duplicate code for each implementation.

    Your scenario may lend itself better to composition than inheritance (or a combination thereof).

    Example – Inheritance + Composition

    public class PhysicalServer : Asset
    {
        public PhysicalInfo PhysicalProperties
        {
             get;
             set;
        }
    }
    
    public class VirtualServer : Asset
    {
        public VirtualInfo VirtualProperties
        {
             get;
             set;
        }
    }
    

    Example – Composition Only

    public class VirtualServer
    {
        public VirtualInfo VirtualProperties
        {
             get;
             set;
        }
    
        public AssetInfo AssetProperties
        {
             get;
             set;
        }
    }
    

    You could then add polymorphism/generics into the mix and create derivatives of types to represent more specific needs.

    Example – Inheritance + Composition + Genericized Member that inherits from a common type

    public class VirtualServer<TVirtualInfo> : Asset
       where TVirtualInfo : VirtualDeviceInfo
    {
        public TVirtualInfo VirtualProperties
        {
             get;
             set;
        }
    }
    
    public class VirtualServerInfo : VirtualDeviceInfo
    {
       // properties which are specific to virtual servers, not just devices
    }
    

    There are countless ways that you could model this out, but armed with interfaces, composition, inheritance, and generics you can come up with an effective data model.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have looked at many other threads that show how to use accelerometer values,
I have looked for an answer for this nearly every where that I can
I have looked around and unable to find an answer to my question. New
I have a program that reads a huge text file (line by line) and
I have looked through a lot of information about this, but I haven't quite
I have a .net file that utilizes a c# to process some form(post) information,
I have looked through all of the other posts that have this problem, to
Have looked quite hard for this answer but having no luck. I have 3
I have looked at questions like this , this , this and this ,
I have looked on the web to find a list of all Python keywords

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.