Click here to Skip to main content
15,891,943 members
Home / Discussions / C#
   

C#

 
AnswerRe: invoking static method by type name Pin
Scott Dorman2-Sep-07 3:09
professionalScott Dorman2-Sep-07 3:09 
GeneralRe: invoking static method by type name Pin
AndrusM2-Sep-07 4:49
AndrusM2-Sep-07 4:49 
GeneralRe: invoking static method by type name Pin
Christian Graus2-Sep-07 5:01
protectorChristian Graus2-Sep-07 5:01 
GeneralRe: invoking static method by type name Pin
AndrusM2-Sep-07 5:28
AndrusM2-Sep-07 5:28 
GeneralRe: invoking static method by type name Pin
Insincere Dave2-Sep-07 7:46
Insincere Dave2-Sep-07 7:46 
Questiondefault accessibility Pin
jon-802-Sep-07 1:11
professionaljon-802-Sep-07 1:11 
AnswerRe: default accessibility Pin
Ahmad Adnan2-Sep-07 3:04
Ahmad Adnan2-Sep-07 3:04 
AnswerRe: default accessibility [modified] Pin
Scott Dorman2-Sep-07 3:05
professionalScott Dorman2-Sep-07 3:05 
The default accessibility is always private. This applies to classes, methods, properties, and fields.

In your code sample, defining MainConsole with out specifying the accessibility makes it private. However, the problem you are running into isn't the accessibility on the class since in this case, they are both private.

In MainConsole you do not have a default constructor, so the compiler is generating one for you. The compiler generated constructor is always private. When you then try to derive MyClass from it, MyClass has a public constructor. What the compiler sees is that you have a class with a public constructor inheriting from one with a private constructor and says that there is no way for the derived class to create an instance of the base class. (If something is private, even the derived classes don't have visibility to it.)



[modification 13:28 Tuesday 4th September, 2007]
I was wrong on this response, not sure what I was thinking. See this response: http://www.codeproject.com/script/comments/forums.asp?forumid=1649&select=2209501&mpp=50&fr=354&df=100#xx2209501xx[^]
[/modification]


Scott.

—In just two days, tomorrow will be yesterday.

[Forum Guidelines] [Articles] [Blog]

GeneralRe: default accessibility Pin
jon-802-Sep-07 4:21
professionaljon-802-Sep-07 4:21 
GeneralRe: default accessibility Pin
Steve Hansen2-Sep-07 7:28
Steve Hansen2-Sep-07 7:28 
GeneralRe: default accessibility Pin
Scott Dorman4-Sep-07 7:28
professionalScott Dorman4-Sep-07 7:28 
AnswerRe: default accessibility for classes can be internal Pin
Arjan Einbu2-Sep-07 4:13
Arjan Einbu2-Sep-07 4:13 
GeneralRe: default accessibility for classes can be internal Pin
jon-802-Sep-07 4:34
professionaljon-802-Sep-07 4:34 
Questionchange defualt priter page size Pin
hamid_m2-Sep-07 0:41
hamid_m2-Sep-07 0:41 
AnswerRe: change defualt priter page size Pin
Vasudevan Deepak Kumar2-Sep-07 0:47
Vasudevan Deepak Kumar2-Sep-07 0:47 
GeneralRe: change defualt priter page size Pin
hamid_m2-Sep-07 1:18
hamid_m2-Sep-07 1:18 
AnswerRe: change defualt priter page size Pin
Rupesh Kumar Swami2-Sep-07 1:06
Rupesh Kumar Swami2-Sep-07 1:06 
QuestionChanging "SizeFromClientSize" Pin
xxxprod1-Sep-07 22:29
xxxprod1-Sep-07 22:29 
QuestionF9 doesn't work in Visual Studio Pin
anderslundsgard1-Sep-07 21:14
anderslundsgard1-Sep-07 21:14 
AnswerRe: F9 doesn't work in Visual Studio Pin
Vasudevan Deepak Kumar1-Sep-07 22:56
Vasudevan Deepak Kumar1-Sep-07 22:56 
QuestionC# Register for COM Interop option Pin
George_George1-Sep-07 19:51
George_George1-Sep-07 19:51 
AnswerRe: C# Register for COM Interop option Pin
Yanshof1-Sep-07 20:55
Yanshof1-Sep-07 20:55 
GeneralRe: C# Register for COM Interop option Pin
George_George1-Sep-07 21:28
George_George1-Sep-07 21:28 
AnswerRe: C# Register for COM Interop option Pin
Vasudevan Deepak Kumar1-Sep-07 22:57
Vasudevan Deepak Kumar1-Sep-07 22:57 
GeneralRe: C# Register for COM Interop option Pin
George_George2-Sep-07 1:51
George_George2-Sep-07 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.