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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:21:25+00:00 2026-05-13T11:21:25+00:00

a question about class design. Currently I have the following structure: abstract Base Repository

  • 0

a question about class design. Currently I have the following structure:

abstract Base Repository Class

Default Repository implementation class (implements some abstract methods, where logic is common thru all of the Specific classes but leaves other empty)

Specific Repository implementation Class (implements what is left empty in the above Default class)

I’ve now came to the problem where I have a specific Update() method in Specific class but when all the code in this method executes some code from the base Default class should be executed too.

I could do it like this

public override Update()
{
    // do Specific class actions and updates
    // ....

    // follow with base.Update()
    base.Update();
}

but this requires those base.XYZ() calls in all the inherited methods. Could I go around that somehow with partials?

So the requirement is to have code in both parent and inherited class (or to make those two one class using partials) and code from method implementation in both places should be executed. Also what about if I wanted to turn it around and execute base class code first followed by the inherited class code?

thanks

  • 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-13T11:21:25+00:00Added an answer on May 13, 2026 at 11:21 am

    Have you considered something like:

    public abstract class YourBaseClass
    {
        public void Update()
        {
            // Do some stuff
            //
    
            // Invoke inherited class's  method
            UpdateCore();
        }
    
        protected abstract void UpdateCore();
    }
    
    public class YourChildClass : YourBaseClass
    {
         protected override void UpdateCore()
         {
             //Do the important stuff
         }
    }
    
    
    //Somewhere else in code:
    var ycc = new YourChildClass();
    ycc.Update();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi: I have a question about how to design and map object class in
To show an example what is this question about: I have currently a dilemma
A quick question about class design. I'm fairly new to Software Development and wondered
A question about c++ design and efficiency... Imagine this code - Database db; class
I have a design question about the communication between the model and the presenter
I have a design question/technical question about my iPhone app. I have a pretty
I'm new in Design Patterns so I have one question about the Builder Pattern.
This question is about a whole class of similar problems, but I'll ask it
I have a question about using streams in .NET to load files from disk.
I have a question about best practices regarding how one should approach storing complex

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.