C# Interview Questions and Answers
<< Previous Question Next Question >>
 Question: 1294 Page Views: 

What is the scope of a class member declared as protected?



Posted By: Avi Date: 30 October 2009 07:03:34 AM
 Answer:

Class member declared as protected can be accessed either only within the same class or within the classes derived from the declaring class.


Posted By: eTechPlanet


Date: 30 October 2009 07:03:34 AM

We can declare a class as protected however its sub-classes (inherited) can only use the objects of that class then. It will not be possible to access the functions of that class with other class's objects.


Posted By: Johndecruse


Date: 17 February 2010 02:15:12 AM
Post a better Answer if you have
 
(Will show your Gravatar icon)  
  Country flag

Loading
Enter the text as shown in the image g3PB26
Related Questions
C# : Name the variables which are under the control of the garbage collector?

Name the variables which are under the control of the garbage collector?

All the variables and objects which are under the process of the framework are under the control of....
Category: C# Date: 10/1/2010 11:28:31 AM
C# : Having the following code:- 
class main
{
 public static void Main()
 {
  try
  {
Console.WriteLine(\"Try block\");
   return;
  }
  finally
  {
Console.WriteLine(\"Finally block\");
  }
 }
} 
Now the question is if return from a try block, does the code in the finally block will execute?

Having the following code:- class main { public static void Main() { try { Console.WriteLine(....

Yes. It is because that the code in the finally block always executes even the try block is executed....
Category: C# Date: 10/1/2010 11:27:31 AM
C# : I want to set different access modifiers on get and set methods of a property. Is it possible to do this thing?

I want to set different access modifiers on get and set methods of a property. Is it possible to do ....

No, it is not possible , as access modifiers are applied to both set and get accessors. If still it ....
Category: C# Date: 10/1/2010 11:26:31 AM
C# : In C# out of internal and private what is the default access specifier of the class and member variable?

In C# out of internal and private what is the default access specifier of the class and member varia....

The access specifier at the class level is internal and at the method and member variable level it i....
Category: C# Date: 10/1/2010 11:25:31 AM
C# : How many Access specifiers are there in C#?

How many Access specifiers are there in C#?

There are 5 access specifiers in C#. They are as follows:- 1. public 2. private 3. protected 4. inte....
Category: C# Date: 10/1/2010 11:24:31 AM