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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:39:40+00:00 2026-05-13T22:39:40+00:00

I have got the following class structure, and have plenty of classes like C

  • 0

I have got the following class structure, and have plenty of classes like C derived from B, in some of the classes I dont want by B.OnShow() but I want A.OnShow() to be executed from C Any tricks?

abstract class A
{
   protected virtual void OnShow()
   {
        //some code
        base.OnShow();
   }
}

class B : A
{
    protected override void OnShow()
    {
      //some other code
      base.OnShow();
    }
}

class C : B
{
   protected override void OnShow()
   {
      //some other code
      base.OnShow();
   }
}
  • 1 1 Answer
  • 3 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-13T22:39:40+00:00Added an answer on May 13, 2026 at 10:39 pm

    Don’t have C extend from B, instead make a new class “X” that extends from A and has the parts that are currently in B that you want for both B and C and then have C and B extend from “X”. Then B will just have the bits in it that you want for B specifically (a bit abstract, but I think that makes sense).

    Generally speaking, if you are trying to skip a parent method then you are doing something wrong.

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

Sidebar

Related Questions

I have a following problem here: in my html structure I got some div's
We have a project structure like following: sharedlib (lib-project, containing classes, that are useful
I have got following class hierarchy in my ASP MVC 3 project. Some entry
I have got the following code: BaseContent.cs public class BaseContent { // Some auto
In some measure of progress since my last question I have got the following
I've got several nested classes, with the following structure: BackupLocation contains list of BackupClients
following is my files directory structure... Config config.php (is calling some files too like
I have the following DOM structure: /*:DOC += <div id='testDiv' class='testDivClass'><div id='innerTestDiv'></div></div><span id='testSpan' class='testSpanClass'><span
I have a simple text file containing some CSV with the following structure: @Parent1_Field1,
I have the following html structure: <div class=divClass> <a class=aClass href=#> <img src=xxxx.jpg <span

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.