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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:57:05+00:00 2026-05-27T08:57:05+00:00

i developed some codes to test.i know : if i use internal method ,

  • 0

i developed some codes to test.i know : if i use internal method , we can hide my method in another namespace forexample:

public vs. internal methods on an internal class

how to hide Add method in Main program;if i ress dot(.) intellisense show me Add method in Base method. i dont want to see add method to derive a instance from MyClass1?


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MyDb;

namespace BaseClassUygulamasi { class Program { static void Main(string[] args) { new MyClass1().Save("123456789", "ali.yilmaz"); } } }

namespace MyDb {

public  abstract class MyBaseClass
{
    private Dictionary<string, string> dic { get; set; }

    public MyBaseClass()
    {

    }

    internal void Add(string key, string value)
    {
        dic.Add(key, value);
    }
}


public class MyClass1 : MyBaseClass
{
    public MyClass1()
        : base()
    {

    }

    public void Save(string TCKimlikNo, string AdSoyAd)
    {
        base.Add(TCKimlikNo, AdSoyAd);
    }
}

}

  • 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-27T08:57:06+00:00Added an answer on May 27, 2026 at 8:57 am

    If you want classes that inherit from your base class to have access to the Add(...) method, but nothing external to that, then you need to mark it as protected, such that:

    public  abstract class MyBaseClass
    {
        private Dictionary<string, string> dic { get; set; }
    
        public MyBaseClass()
        {
    
        }
    
        protected void Add(string key, string value)
        {
            dic.Add(key, value);
        }
    }
    
    
    public class MyClass1 : MyBaseClass
    {
        public MyClass1()
            : base()
        {
    
        }
    
        public void Save(string TCKimlikNo, string AdSoyAd)
        {
            base.Add(TCKimlikNo, AdSoyAd);
        }
    }
    

    This way, only classes that inherit from MyBaseClass will be able to access Add(...).

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

Sidebar

Related Questions

I'm attempting to write some annotations to help associatate test case methods with various
I'm trying to compile with g++ some code previously developed under Visual C++ 2008
Task at hand — I have three versions of some code, developed by different
I have some ANSI C code that I developed on my Mac, but when
I need to work with some old C++ code that was developed in Visual
I had a previous question can jquery ajax call external webservice? and some good
I'm creating a simple test application so I can see how ASP.Net MVC works
I wrote some code to generate a boost::mpl::vector to use as a lookup table
I'm trying to develop an image focusing algorithm for some test automation work. I've
I developed some JUnit tests that extend org.apache.struts2.StrutsTestCase. I used the tutorial on struts.apache.org

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.