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

  • Home
  • SEARCH
  • 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 733919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:18:44+00:00 2026-05-14T07:18:44+00:00

Alright, so as you probably know, static inheritance is impossible in C#. I understand

  • 0

Alright, so as you probably know, static inheritance is impossible in C#. I understand that, however I’m stuck with the development of my program.

I will try to make it as simple as possible. Lets say our code needs to manage objects that are presenting aircrafts in some airport. The requirements are as follows:

  • There are members and methods that are shared for all aircrafts

  • There are many types of aircrafts, each type may have its own extra methods and members. There can be many instances for each aircraft type.

  • Every aircraft type must have a friendly name for this type, and more details about this type. For example a class named F16 will have a static member FriendlyName with the value of “Lockheed Martin F-16 Fighting Falcon”.

  • Other programmers should be able to add more aircrafts, although they must be enforced to create the same static details about the types of the aircrafts.

  • In some GUI, there should be a way to let the user see the list of available types (with the details such as FriendlyName) and add or remove instances of the aircrafts, saved, lets say, to some XML file.

So, basically, if I could enforce inherited classes to implement static members and methods, I would enforce the aircraft types to have static members such as FriendlyName. Sadly I cannot do that.

So, what would be the best design for this scenario?

  • 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-14T07:18:44+00:00Added an answer on May 14, 2026 at 7:18 am

    One answer is to decorate each class with attributes (metadata):

    [Description("Lockheed Martin F-16 Fighting Falcon")]
    public class F16 : Aircraft
    {
        // ...
    }
    

    This is using the DescriptionAttribute already in System.ComponentModel.

    You can get the metadata like this:

    Type t = typeof(F16);
    DescriptionAttribute attr = (DescriptionAttribute)Attribute.GetCustomAttribute(t,
        typeof(DescriptionAttribute));
    string description = (attr != null) ? attr.Description : t.Name;
    

    This will get you the description text from a reference to the F16 class.

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

Sidebar

Related Questions

Alright, currently I have my SWF hitting a php file that will go and
Alright, I'm trying to read a comma delimited file and then put that into
Alright, I know how the fieldset / legend works out in HTML. Say you
Alright, quick question. A server is running in Eastern Time. PHP program needs to
Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
Alright. So I figure it's about time I get into unit testing, since everyone's
Alright, I have been doing the following (variable names have been changed): FileInputStream fis
Alright. So I have a very large amount of binary data (let's say, 10GB)
Alright, after doing a ton of research and trying almost every managed CPP Redist

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.