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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:00:57+00:00 2026-05-17T22:00:57+00:00

Here is an example. I have two classes, one inherited, and both have a

  • 0

Here is an example. I have two classes, one inherited, and both have a function with the same name, but different arguments:

public class MyClass
{
    //public class members

    public MyClass()
    {
        //constructor code
    }

    public void Copy(MyClass classToCopy)
    {
        //copy code
    } 
}

public class InheritedClass : MyClass
{
    //public class members

    public InheritedClass():base()
    {
        //constructor code
    }

    public void Copy(InheritedClass inheritedClassToCopy)
    {
        //copy code
    } 
}

My question is how do I make the base class’ copy method (MyClass.Copy) non-inheritable or non-visible in InheritedClass? I don’t want to be able to do this:

MyClass a;
InheritedClass b;
b.Copy(a);

Does this make sense, or should I keep this functionality in there? Can what I’m asking even be done?

  • 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-17T22:00:57+00:00Added an answer on May 17, 2026 at 10:00 pm

    Does this make sense, or should I keep this functionality in there? Can what I’m asking even be done?

    Trying to hide a public method like this when used by a base class is problematic. You’re purposely trying to violate the Liskov substitution principle.

    alt text

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

Sidebar

Related Questions

I have two classes. One is a management class, which stores a bunch of
I feel like I skipped a C# class or two, but here's my dilemma:
I'm having trouble trying to implement a shared method/property between two classes created by
I use Entity Framework to access my SQL data. I have some constraints in
EDIT> i am at a dead end... so i can continue looking for the
I'm using the following snippet to create a select/deselect all checkboxes: http://www.wiseguysonly.com/2010/01/15/select-and-unselect-all-checkboxes-with-jquery/ This is
I'm really thinking that in the years ahead, I will be creating internal apps
Input: Graph G Output: several independent sets, so that the membership of a node
I'm working on a little html/css framework that I can use for most of
I'm looking for help identifying this design pattern and learning the typical vocabulary it

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.