Click here to Skip to main content
15,885,936 members
Home / Discussions / C#
   

C#

 
GeneralRe: to display image from listview Pin
deleepkv18-Jun-09 23:57
deleepkv18-Jun-09 23:57 
Questionhow to Include Graph in C# windows Application Pin
Mads11518-Jun-09 20:49
Mads11518-Jun-09 20:49 
AnswerRe: how to Include Graph in C# windows Application Pin
stancrm18-Jun-09 21:03
stancrm18-Jun-09 21:03 
GeneralRe: how to Include Graph in C# windows Application Pin
Mads11518-Jun-09 21:31
Mads11518-Jun-09 21:31 
Questionis there a way to print pdf on different printers without making the alignment run out, using iReport? Pin
daffy_200318-Jun-09 20:31
daffy_200318-Jun-09 20:31 
Questionsqlbulkcopy issues Pin
havejeet18-Jun-09 20:17
havejeet18-Jun-09 20:17 
AnswerRe: sqlbulkcopy issues Pin
Mycroft Holmes18-Jun-09 22:02
professionalMycroft Holmes18-Jun-09 22:02 
QuestionHow is it possible to access private members of a class becoz the property of the field is made protected internal ? Pin
Member 397434718-Jun-09 20:05
Member 397434718-Jun-09 20:05 
In the msdn page [^]
it says "When a member of a class or struct is a property, field, method, event, or delegate, and that member either is a type or has a type as a parameter or return value, the accessibility of the member cannot be greater than the type. For example, you cannot have a public method M that returns a class C unless C is also public. Likewise, you cannot have a protected property of type A if A is declared as private. "

But in this code
class AccessSpecifier
   {
      // private field:
      private int wheels = 3;

      // protected internal property:
       protected internal int Wheels
       {
           get { return wheels; }
           set { wheels = value;  }
       }

   }
   class Derieved : AccessSpecifier
   {
       public void fun()
       {
           Wheels = 90; //accessing private mem of base class
       }
   }
   class main
   {
       public static void Main()
       {
           AccessSpecifier a = new AccessSpecifier();
           a.Wheels = 4;
           Console.WriteLine(a.Wheels); // gives 4 as output
           Derieved d = new Derieved();
           d.fun();
           Console.WriteLine(d.Wheels); //gives 90 as output
           d.Wheels = 99; //accessing private mem of a class in same assembly   :omg:
           Console.WriteLine(d.Wheels);
           Console.ReadKey();

       }
   }


How is this possible to access private members of a class jus becoz the property of the field is made protected internal ? And compiler is against the lines given in MSDN? Can u pls explain ?Confused | :confused:
AnswerRe: How is it possible to access private members of a class becoz the property of the field is made protected internal ? Pin
Christian Graus18-Jun-09 20:32
protectorChristian Graus18-Jun-09 20:32 
AnswerRe: How is it possible to access private members of a class becoz the property of the field is made protected internal ? Pin
Vikram A Punathambekar18-Jun-09 20:34
Vikram A Punathambekar18-Jun-09 20:34 
GeneralRe: How is it possible to access private members of a class becoz the property of the field is made protected internal ? Pin
Christian Graus18-Jun-09 21:39
protectorChristian Graus18-Jun-09 21:39 
GeneralRe: How is it possible to access private members of a class becoz the property of the field is made protected internal ? Pin
Vikram A Punathambekar19-Jun-09 0:01
Vikram A Punathambekar19-Jun-09 0:01 
AnswerRe: How is it possible to access private members of a class becoz the property of the field is made protected internal ? Pin
PIEBALDconsult19-Jun-09 5:36
mvePIEBALDconsult19-Jun-09 5:36 
QuestionMouseHover Event Pin
deepseeindeepsy18-Jun-09 19:55
deepseeindeepsy18-Jun-09 19:55 
AnswerRe: MouseHover Event Pin
musefan18-Jun-09 21:56
musefan18-Jun-09 21:56 
QuestionSystem.AccessViolationException Pin
siddy1718-Jun-09 19:13
siddy1718-Jun-09 19:13 
AnswerRe: System.AccessViolationException Pin
Christian Graus18-Jun-09 19:29
protectorChristian Graus18-Jun-09 19:29 
GeneralRe: System.AccessViolationException Pin
siddy1718-Jun-09 19:57
siddy1718-Jun-09 19:57 
GeneralRe: System.AccessViolationException Pin
Christian Graus18-Jun-09 21:28
protectorChristian Graus18-Jun-09 21:28 
QuestionGUI interface for launching a ethernet packet Pin
moniska18-Jun-09 16:55
moniska18-Jun-09 16:55 
AnswerRe: GUI interface for launching a ethernet packet Pin
Rajesh Anuhya18-Jun-09 18:11
professionalRajesh Anuhya18-Jun-09 18:11 
GeneralRe: GUI interface for launching a ethernet packet Pin
moniska21-Jun-09 16:59
moniska21-Jun-09 16:59 
QuestionWindows service Stop issue Pin
mark_me18-Jun-09 16:11
mark_me18-Jun-09 16:11 
AnswerRe: Windows service Stop issue Pin
Mycroft Holmes18-Jun-09 17:57
professionalMycroft Holmes18-Jun-09 17:57 
GeneralRe: Windows service Stop issue Pin
mark_me14-Jul-09 17:29
mark_me14-Jul-09 17:29 

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.