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 938545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:39:44+00:00 2026-05-15T21:39:44+00:00

Possible Duplicate: Multiple Inheritance in C# In the following example, I want the Shirt

  • 0

Possible Duplicate:
Multiple Inheritance in C#

In the following example, I want the Shirt to automatically inherit the properties of both the Material and Pigment classes. Is this even possible in C#?

public class Material
{
    public enum FabricTypes { Cotton, Wool, Polyester, Nylon }
    public FabricTypes Fabric { get; set; }
    public Color Color { get; set; }
}

public class Pigment
{
    public enum PigmentQualities { Fine, Average, Poor }
    public PigmentQualities Quality { get; set; }
    public Color Color { get; set; }
}

public class Shirt : Material //, Pigment
{
    public Shirt()
    {
        Fabric = FabricTypes.Cotton;
        Color = new Color();
        //Quality = PigmentQualities.Fine;
    }
}

I’m having a hard time furnishing a better example, but this is essentially what I’m trying to do. I realize I can create interfaces, but those won’t automatically inherit the properties. See, because I don’t want to have to manually punch in all those properties every time I create a class that is similar to Shirt.

  • 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-15T21:39:45+00:00Added an answer on May 15, 2026 at 9:39 pm

    C# doesn’t allow to inherit from multiple classes.

    But why do you do it like this? Shirt could have 2 properties instead: Material and Pigment. Those could be set when you initialize a Shirt instance like passing it in a constructor with those properties set. Or create a constructor in which you can pass certain properties and instantiate Material and Pigment in that constructor.

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

Sidebar

Related Questions

Possible Duplicate: What is the exact problem with multiple inheritance? Why is multiple inheritance
Possible Duplicate: Should C# include multiple inheritance? One of my friend asked me the
Possible Duplicate: Singleton: How should it be used Following on from Ewan Makepeace 's
Possible Duplicates: Should C# include multiple inheritance? Why C# doen’t support multiple inheritance Why
Possible Duplicates: C++ pointer multi-inheritance fun. more c++ multiple inheritance fun This is a
Possible Duplicate: Multiple forms on ASP.NET page i have a doubt. can we place
Possible Duplicate: Catch multiple Exceptions at once? Is there any way in C# to
Possible Duplicate: select multiple rows from uitableview and delete I am developing an application
Possible Duplicate: R: Finding patterns across multiple columns- possibly duplicated()? Dear all, Here is
Possible Duplicate: SQL left join vs multiple tables on FROM line? SELECT messages.message_title, messages.message_content,

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.