What is the DIfference between Friend and Protected Friend?
Answers were Sorted based on User's Feedback
Answer / benjamin marty
I guess the difference is this:
Friend can be accessed by
1. Code within the class
2. Code in derived classes within the same assembly
3. Other code in the same assembly
Protected can be accessed by
1. Code within the class
2. Code in derived classes within the same assemblies
3. Code in derived classes in other assemblies
Protected Friend can be accessed by
1. Code within the class
2. Code in derived classes within the same assembly
3. Other code in the same assembly
4. Code in derived classes in other assemblies
| Is This Answer Correct ? | 47 Yes | 9 No |
Answer / vineeta agarwal
Friends can be accessed by all classes within assembely but
not from outside the assembely.
Protected variables can be used within the class as well as
the classes that inherites this class.
The Protected Friend can be accessed by Members of the
Assembely (Friend) or the inheriting Assembely class
(Protected).
So Friend is not same as Protected Friend
| Is This Answer Correct ? | 22 Yes | 7 No |
Answer / rituraj raman
Friend can be access by anywhere but only in
same assembly
Protected Friend can be access by anywhere
in same assembly and
drived classes in other assemblies as well
| Is This Answer Correct ? | 17 Yes | 3 No |
Answer / rajeev pradhan
Protected variable will be accessed in inherited class, but
instance variable of class cant access protected variable.
While friend variable will be accessed in inherited class
as well as instance variable of class across the project.
Where we need both functionality we are using protected
friend scope.
| Is This Answer Correct ? | 25 Yes | 12 No |
Answer / kuru
Protected --> Accessible ONLY by 1.Derived classes 2.Within
the same class
Friend --> Accessible ONLY by 1.Derived classes 2.Classes
in the same assembly 3.Within the same class
Protected Friend --> Accessible ONLY by 1.Derived classes
2.Classes in the same assembly 3.Within the same class
This is a very strange prob for which I've been looking for
an answer for a long time. As you can see above Friend and
Protected Friend are exactly same simply because 'Friend'
encompasses the accessibilities of both Protected and
Protected Friend. The question here is why did Microsoft
publish a 'Protected Friend' keyword when it is EXACTLY
same as Friend.
| Is This Answer Correct ? | 11 Yes | 20 No |
Can you please explain the difference between authentication and authorization?
Name some of the keywords used in vb.net?
Define serialization in .net?
What do you mean by serialization and deserialization?
What are the features of c# which are not present in vb.net?
How do you retrieve the customized properties of a .net application from xml .config file?
hi dear ! thank u for replying to my question regarding adding third party software in vb.net .My next question is that i haven created Data base in SQL server 2000 for Library and has connected that with VB and VB.net separately but it only works on single computer and when i takes my software to another computer on same Network it does not work . Can any body help me what i do to solve. Regards!
when a program of vb.net is written in notepad it occupies always 1kb of memory why?
write a program to develop a graphic user interface application of marks book with students names and their names.the program should show the following options main menu,add student details,display student details,maximum mark and minimum mark.
0 Answers College School Exams Tests,
Why is the xml infoset specification different from the xml dom?
What is the differences between dataset.clone and dataset.copy?
What are the assembly entry points?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)