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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:53:25+00:00 2026-06-13T08:53:25+00:00

I have the following inheritance: class A { void Configure(object param1) {…}; } class

  • 0

I have the following inheritance:

class A
{
    void Configure(object param1) {...};
}

class B : A
{
    void Configure(object param1) {...}; // The method is not defined in B, it is available from the base class. This is just the desired interface of class B
}

class C : A
{
    void Configure(object param1, object param2) {...};
}

I don’t want class C to have a Configure with param1 visible as in this case it will leave the object incomplete.

I tried overriding but override cannot change the visibility.

The only approach I found is calling the class A method protected void ConfigureBase(object param1) {...}; and making method Configure of class B call ConfigureBase.

As I’m not completely happy with this design as it makes me redefine on each class the Configure is there a standard way of handling this?

  • 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-13T08:53:26+00:00Added an answer on June 13, 2026 at 8:53 am

    This is not possible. You could possibly have the method just throw an exception so it couldn’t be used, but one of the fundamental principles of inheritance in programming is that a child can always be treated as if it were of it’s parent’s type. What should the following do:

    A obj = new C();
    
    obj.Configure(new object());//should this work, or not?
    

    By design, there is no way to restrict a child to not be able to do something it’s parent could do. You would need to more fundamentally re-design your program if C really shouldn’t have access to a Configure(object obj) method. This could possibly mean that C really shouldn’t extend A (It might make sense for both A and C to implement a common interface.), or just that Configure really shouldn’t be a public method of that type. Without knowing more, it’s hard to suggest alternatives.

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

Sidebar

Related Questions

I have the following problem with inheritance and templates: class Base {}; class Deriv
In Objective-C, I have a base class A, with instance method -(void) doSomething. Class
I have the following class hierarchy in C++: class Base { virtual void apply()
Suppose I have following inheritance tree: SDLBullet inherits from Bullet inherits from Entity EnemyBullet
I have the following two interfaces, which are not part of an inheritance hierarchy.
I would to block child classes from overriding a base method and have the
in C++, i have the class Base as a interface class and 2 inheritance
We have an entity framework model with has some inheritance in it. The following
I have following div in a page (I can not modify). <div id=:0.control>Click me</div>
I have the following class and extension class (for this example): public class Person<T>

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.