Click here to Skip to main content
15,900,906 members
Home / Discussions / C#
   

C#

 
GeneralRe: Save Pin
Mark Churchill2-Sep-07 19:04
Mark Churchill2-Sep-07 19:04 
AnswerRe: Save Pin
Guffa2-Sep-07 6:52
Guffa2-Sep-07 6:52 
GeneralRe: Save Pin
Assaf822-Sep-07 7:17
Assaf822-Sep-07 7:17 
GeneralRe: Save Pin
Christian Graus2-Sep-07 7:25
protectorChristian Graus2-Sep-07 7:25 
GeneralRe: Save Pin
Guffa2-Sep-07 8:27
Guffa2-Sep-07 8:27 
GeneralRe: Save Pin
Assaf822-Sep-07 8:29
Assaf822-Sep-07 8:29 
GeneralRe: Save Pin
Christian Graus2-Sep-07 8:33
protectorChristian Graus2-Sep-07 8:33 
GeneralRe: Save Pin
Pete O'Hanlon2-Sep-07 9:54
mvePete O'Hanlon2-Sep-07 9:54 
Questioninvoking static method by type name Pin
AndrusM2-Sep-07 1:14
AndrusM2-Sep-07 1:14 
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 

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.