Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

When you inherit a protected class-level variable, who is it
available to?

Answer Posted / kiran

//When you inherit a protected class-level variable, who is
it available to?
//Answer is classes within the same namespace
namespace SameNamespace
{
class MyBaseClass
{
protected int myprotectedint;

}
class MyDerivedClass:MyBaseClass
{
public int GetProtectedMember()
{
return myprotectedint;
}
public MyDerivedClass(int myvalue)
{
myprotectedint = myvalue;
}

}

class MyTest
{
public static void Main()
{
MyDerivedClass mdc = new MyDerivedClass(12);

Console.WriteLine(mdc.GetProtectedMember());
Console.ReadKey();
}
}
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is windows application in c#?

865


Is overriding of a function possible in the same class?

888


What’s thread.sleep() in threading ?

957


What can be done with c#?

790


What are the collection types can be used in c#?

826


What are functions in c#?

848


What is a method c#?

900


What are properties in c#. Explain with an example?

849


Is learning c# hard?

874


What is the use of list in c#?

797


What is a template class?

925


What is unsigned int?

845


What is class method c#?

845


What is Event - Delegate?

1011


What is the difference between function and method in c#?

850