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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:50:06+00:00 2026-06-07T21:50:06+00:00

I’m needing some advice on structuring my classes for an application which models 6

  • 0

I’m needing some advice on structuring my classes for an application which models 6 different but similar types. The 6 types have some properties and methods they will all share. There are also properties and methods that 3, 4, or 5 of them will share but would have no meaning to the others.

Currently, I have an abstract base class with:

  • properties and methods that all of the subclasses will use, already implemented.
  • methods that some of the subclasses will use marked as abstract, to be implemented in the subclasses.
  • properties that some of the subclasses will use marked as nullable so that subclasses in which the property would not be used it could be null.

This just doesn’t seem like the best solution though. I feel like I have provided enough details, but if this doesn’t make sense just let me know and I will try to provide a better description.

EDIT — adding code example

public abstract class BaseClass
{
    //all classes inheriting from BaseClass would use these properties
    public string Property1{ get; set; }
    public string Property2{ get; set; }

    public void Method1() {
        //all classes inheriting from BaseClass would use this method
    }

    //more than one class (but not all classes) 
    //  inheriting from BaseClass would use these properties
    public int? Property3 { get; set; }
    public bool? Propert4 { get; set; }

    public abstract void Method2() {
        //more than one class (but not all classes) 
        //  inheriting from BaseClass would use this method

        //those not using this method would have empty getters and setters maybe?
    }
}
  • 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-06-07T21:50:07+00:00Added an answer on June 7, 2026 at 9:50 pm

    This just doesn’t seem like the best solution though. I feel like I have provided enough details, but if this doesn’t make sense just let me know and I will try to provide a better description.

    There is little detail, but it does sound like you’d be better off having a separate “layer” in your class hierarchy.

    Classes 3, 4, and 5 could derive from a separate abstract class, which in turned inherited your “base” class. This would eliminate the need for classes 1 and 2 to have the “unused” methods and properties in them.

    Basically, the “properties that some of the subclasses will use marked as nullable so that subclasses in which the property would not be used it could be null” would not be in the base class, but rather added to a subclass, which in turn was subclasses for 3, 4, and 5.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I have a text area in my form which accepts all possible characters from
Thanks in advance for your help. I have a need within an application to
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is

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.