about class definition

T

tony

Hello!

The general form of a class definition is the following.
[Modifiers] class ClassName : [Base Class, [Interfaces]]

The modifiers is optional.
If modifiers is blank what exactly does that mean?
What availability do I have to the class?

//Tony
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

It goes internal by default.
It means that only is accesible only in the assembly it's declared.
If you declare it internal it's an error declaring a public descendant.

Ps:
I would suggest you to always indicate the access of a class.
 
G

Guest

Outer classes default to internal. Inner classes default to private.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
C# Code Metrics: Quick metrics for C#
 
J

Jon Skeet [C# MVP]

<"Ignacio Machin \( .NET/ C# MVP \)" <ignacio.machin AT
dot.state.fl.us> said:
It goes internal by default.
It means that only is accesible only in the assembly it's declared.
If you declare it internal it's an error declaring a public descendant.

Ps:
I would suggest you to always indicate the access of a class.

I take the opposite approach - when I can, I use the default. The
default is always the most restrictive access you can give in C#, which
is an excellent default position. That way, any modifiers highlight the
fact that something is more public than it might be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top