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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:02:12+00:00 2026-05-18T08:02:12+00:00

Look here (Abstract Class Design): http://msdn.microsoft.com/en-us/library/ms229047.aspx It says: (1) Do not define public or

  • 0

Look here (Abstract Class Design): http://msdn.microsoft.com/en-us/library/ms229047.aspx

It says:

(1) Do not define public or protected internal (Protected Friend in Visual Basic) constructors in abstract types.

In C#, we are not able to instantiate an abstract class. So, does it still matter to define public constructors for abstract classes in C# ? Or not writing public constructors for abstract classes because of semantic meaning?

It also says:

(2) Do define a protected or an internal constructor in abstract classes.

Define internal constructors ?? In (1), it tells us that not defining internal protected constructors is because that “Constructors with public or protected internal visibility are for types that can be instantiated”. Doesn’t defining internal constructors for abstract classes break the rules in (1) ?

Thanks in advance. 🙂

  • 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-18T08:02:13+00:00Added an answer on May 18, 2026 at 8:02 am

    Let’s look at each of the cases.

    Recommended:

    • protected – The most obvious case – all subclasses can call the constructor, irrespective of which assembly they reside in (as long as the the abstract base-class itself is visible to them).

    • internal – Useful when you want the abstract type to be publicly visible, but not publicly inheritable. In this case, you would want to make all of the non-private constructors internal. Only subclasses within the same assembly as the abstract base-class would be able to call the constructors – effectively, only they would be able to inherit. Another use-case would be if you wanted a ‘special’ constructor that should only be visible to same-assembly subclasses.

    • private – Used mainly for ‘dirty-work’ constructors that are targeted by other constructors of the abstract class when it uses constructor-chaining. The only other use, when all the constructors are private, is to only allow subclassing by nested classes, which do have access to private members of the containing-type.


    Not recommended:

    • public – Not useful, behaves identically to protected. Only subclasses can call the constructor anyway, since the base-class is abstract.

    • protected internal – This too is no different from protected. The protected internal accessibility level means protected OR internal, not protected AND internal. However, the internal modifier here serves no purpose – it doesn’t prevent subclasses residing outside the assembly from calling the constructor (assuming the abstract base-class is public) since they can rely on protected access, nor does it allow same-assembly types that are not subclasses from calling it (the type is abstract).

    The key point here is that every non-private constructor in an abstract class is already at best protected. The vanilla internal-modifier strengthens restrictions on who can call the constructor. public and protected internal don’t accomplish anything because they appear to weaken restrictions, but don’t really succeed in doing so.

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

Sidebar

Related Questions

Anybody know what my DLLImport statement should look like here: extern C __declspec(dllexport) long
Here is what my svn repository look like: / /libraries /libA /libB /libC /tools
Here's the idea, I'd like to make a service? that will look for a
I've read the description of functionoids here . They look like a poor-man's version
Look at this image: alt text http://img139.imageshack.us/img139/4488/picture2ep3.png I know how to add UITableView with
Look at this situation: www.websitea.com displays an img tag with a src attribute of
i am a newbie to the design patterns and here is my question if
Please take a look at this piece of code I came up with. abstract
I have a class structure like abstract class Animal { public Animal(){ //init stuff..
So, I have an abstract class Panel and an implementation of it MyPanel .

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.