Since we can access the private data member of base class in the derived class with the help of friend function. How can we do the same in C# asp.net? I mean whats the alternative of friend function in C# asp.net?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
internalis the access modifier for stuff that needs tobe accessible in a single assembly.protectedis the modifier to get access to base class stuff.If you have no control over the base class and need to ‘hack’ access, NHibernate does that sort of thing, e.g. when creating a performant setter on private instance fields. In this case the source code of the method
NHibernate.Bytecode.Lightweight.ReflectionOptimizer.GenerateSetPropertyValuesMethodcould be of interest to you.