IT Community - Software Programming, Web Development and Technical Support

what is the difference between internal protected and protected?

This is a discussion on what is the difference between internal protected and protected? within the C# Programming forums, part of the Software Development category; Hi, Please explain me the use of keyword internal protected with an example ?? what is the difference between internal protected ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 11-22-2007, 04:45 AM
oxygen oxygen is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 633
oxygen is on a distinguished road
Default what is the difference between internal protected and protected?

Hi,
Please explain me the use of keyword internal protected with an example ??

what is the difference between internal protected and protected ??

Can constructor be declared protected ?? why or why not???
__________________
The OXYGEN
Delivers edgy, intelligent Technology to all...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-22-2007, 04:47 AM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 182
Balasubramanian.S is on a distinguished road
Default Re: what is the difference between internal protected and protected?

Hi,

If we use "protected" before a method/variable, it can be accessed only to derived class.

If we use "internal" before a method/variable, it can be access only within the same assembly.

So, internal protected can be accessed within the same assembly as well as in derived class.

protected constructors - Yes, you can use I think. Below is some Info.

Peter Hallam's WebLog : Many Questions: Protected Constructors
__________________
S.Balasubramanian
Nothing is impossible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-22-2007, 04:51 AM
KiruthikaSambandam KiruthikaSambandam is offline
D-Web Analyst
 
Join Date: Aug 2007
Posts: 332
KiruthikaSambandam is on a distinguished road
Default Re: what is the difference between internal protected and protected?

difference between internal protected and protected

Protected:

A protected member is accessible from within the class in which it is declared, and from within any class derived from the class that declared this member.

Internal Protected:

Internal types or members are accessible only within files in the same assembly.

ThankQ
KiruthikaSambandam
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 11-22-2007, 04:52 AM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default Re: what is the difference between internal protected and protected?

The constructor is meant to be used by a derived class only.

If all the constructors are protected then I guess its a way of saying don't
declare a variable with this class, derive your own class from this class
and use that. But I'd also say there a better ways of doing that, just
making the class abstract will also have the same effect.
__________________
Shaalini.S
Be the Best of Whatever you are...

Last edited by shaalini : 11-22-2007 at 04:54 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 11-22-2007, 06:19 AM
sathian sathian is offline
D-Web Analyst
 
Join Date: Aug 2007
Posts: 252
sathian is on a distinguished road
Default Re: what is the difference between internal protected and protected?

protected.

Access is limited to the containing class or types derived from the containing class.

internal

Access is limited to the current assembly.

protected internal

Access is limited to the current assembly or types derived from the containing class.

Thanks

Sathian.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Attempted to read write protected memory Balasubramanian.S C# Programming 0 03-21-2008 09:47 PM
Crack a password protected word document using C#? $enthil C# Programming 3 11-19-2007 11:33 PM
How to convert the Normal PDF to protected PDF in Asp.net?(i.e user should save the p bluesky ASP and ASP.NET Programming 0 07-16-2007 12:27 AM


All times are GMT -7. The time now is 01:20 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0