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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:21:34+00:00 2026-06-06T17:21:34+00:00

Since we know that constructor is not inherited in the child class as i

  • 0

Since we know that constructor is not inherited in the child class as i asked in the my previous question Click here to view question

I had write the code

namespace TestConscoleApplication
{
    abstract public class A
    {
       public int c;
       public int d;

    private  A(int a, int b)
       {
           c = a;
           d = b;

       }
        public virtual void Display1()
        {
            Console.WriteLine("{0}{1}", c, d);
        }
    }
    internal class B : A 
    {
      protected  string Msg;

      public B(string Err)

        {
            Msg = Err;

        }

        public  void Display()
        {
            Console.WriteLine(Msg);
        }
    }



    class Program
    {
        static void Main(string[] args)
        {
            B ObjB = new B("Hello");


            Console.ReadLine();
        }
    }
}

when i compile the code its showing an error

Error TestConscoleApplication.A.A(int, int) is inaccessible due to its protection level.

Then why it is showing an error.

  • 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-06T17:21:35+00:00Added an answer on June 6, 2026 at 5:21 pm

    By making the only constructor of A private, you’ve prevented derived classes from being able to be constructed outside A.

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

Sidebar

Related Questions

I know that calling a virtual method from a base class constructor can be
I know not my .htaccess is working since it is showing the ErrorDocument 404
I know it is still not quite popular, since the spec was released just
I know SysCache uses ASP caching under the hood, but since I'm not aware
Here is something that I have came across in Scala that did not cause
I read this question here: Is there a way to override the empty constructor
I know that the UI elements (View hierarchy) may only be manipulated from the
Since I don't quite know the language of these types of algorithms (i.e. how
I know it can't be done since using var can only be done for
Do you know of any practical use of If-Unmodified-Since in the wild? From the

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.