Click here to Skip to main content
15,892,480 members
Home / Discussions / C#
   

C#

 
GeneralRe: FDML Pin
Vasudevan Deepak Kumar6-Aug-07 0:56
Vasudevan Deepak Kumar6-Aug-07 0:56 
AnswerRe: FDML Pin
Vasudevan Deepak Kumar6-Aug-07 0:57
Vasudevan Deepak Kumar6-Aug-07 0:57 
AnswerRe: FDML Pin
Nouman Bhatti6-Aug-07 1:59
Nouman Bhatti6-Aug-07 1:59 
Questionsetting a default value for dropdown Pin
Ni Na5-Aug-07 23:58
Ni Na5-Aug-07 23:58 
AnswerRe: setting a default value for dropdown Pin
Luc Pattyn6-Aug-07 0:08
sitebuilderLuc Pattyn6-Aug-07 0:08 
GeneralRe: setting a default value for dropdown Pin
Ni Na6-Aug-07 1:59
Ni Na6-Aug-07 1:59 
QuestionHow to retreive RAM size Pin
Phanindra Kumar5-Aug-07 23:31
Phanindra Kumar5-Aug-07 23:31 
AnswerRe: How to retreive RAM size Pin
Luc Pattyn5-Aug-07 23:45
sitebuilderLuc Pattyn5-Aug-07 23:45 
AnswerRe: How to retreive RAM size Pin
Vasudevan Deepak Kumar6-Aug-07 0:58
Vasudevan Deepak Kumar6-Aug-07 0:58 
AnswerRe: How to retreive RAM size Pin
Nouman Bhatti6-Aug-07 2:07
Nouman Bhatti6-Aug-07 2:07 
Questionis a File Read Only. Pin
Saqib Mehmood5-Aug-07 22:32
Saqib Mehmood5-Aug-07 22:32 
AnswerRe: is a File Read Only. Pin
N a v a n e e t h5-Aug-07 22:53
N a v a n e e t h5-Aug-07 22:53 
AnswerRe: is a File Read Only. Pin
Nouman Bhatti6-Aug-07 2:05
Nouman Bhatti6-Aug-07 2:05 
Questioninternal and internal protected Pin
Sonia Gupta5-Aug-07 22:25
Sonia Gupta5-Aug-07 22:25 
AnswerRe: internal and internal protected Pin
N a v a n e e t h5-Aug-07 22:46
N a v a n e e t h5-Aug-07 22:46 
GeneralRe: internal and internal protected Pin
Sonia Gupta5-Aug-07 23:00
Sonia Gupta5-Aug-07 23:00 
GeneralRe: internal and internal protected Pin
N a v a n e e t h6-Aug-07 1:13
N a v a n e e t h6-Aug-07 1:13 
AnswerRe: internal and internal protected Pin
m@u5-Aug-07 23:41
m@u5-Aug-07 23:41 
Hi
Protected is like a private member for a class, but it's visible in derived classes also.
internal is like public but only inside the current assembly.

so.
if you need a property that can be accessed from other classes inside your assembly and a derived class from another assembly should be able to provide a value for it, you make it
protected internal, which means public inside the current assembly and private for all the other asemblies.

let's say you have 2 assemblies the BaseClassLib and the ConsumerLib

now in the BaseClassLib you have 2 classes called ConsumerClass and ProviderClass

<br />
public class ConsumerClass<br />
{<br />
    public ConsumerClass(ProviderClass Provider)<br />
    {<br />
        // calls the Protected internal function of any ProviderClass-derived class<br />
        Console.WriteLine(Provider.getProtIntVal());<br />
    }<br />
}<br />
public abstract class ProviderClass<br />
{<br />
    protected internal abstract string getProtIntVal();<br />
}<br />


in the ConsumerLib you have a Reference to the ProviderLib and you have 2 classes called StartupClass and DerivedProviderClass

<br />
public class DerivedProviderClass:ProviderClass<br />
{<br />
    public DerivedProviderClass()<br />
    {<br />
    }<br />
    protected override string getProtIntVal()<br />
    {<br />
        return "this is a string";<br />
    }<br />
}<br />
public class StartupClass<br />
{<br />
    [STAThread]<br />
    public static void Main(params string[] args)<br />
    {<br />
        DerivedProviderClass c = new DerivedProviderClass();<br />
        // Next will cause a compiler - Error<br />
        console.WriteLine(c.getProtIntVal());<br />
        // Next will work<br />
        ConsumerClass cons = new ConsumerClass(c);<br />
    }<br />
}<br />


hope this helps
greets
m@u
AnswerRe: internal and internal protected Pin
Hessam Jalali5-Aug-07 23:46
Hessam Jalali5-Aug-07 23:46 
AnswerRe: internal and internal protected Pin
Pete O'Hanlon6-Aug-07 1:34
mvePete O'Hanlon6-Aug-07 1:34 
GeneralRe: internal and internal protected Pin
Sonia Gupta6-Aug-07 1:41
Sonia Gupta6-Aug-07 1:41 
GeneralRe: internal and internal protected Pin
Pete O'Hanlon6-Aug-07 2:42
mvePete O'Hanlon6-Aug-07 2:42 
GeneralRe: internal and internal protected Pin
originSH6-Aug-07 4:03
originSH6-Aug-07 4:03 
QuestionTake over a GUI of running program Pin
Morad Kobi5-Aug-07 22:21
Morad Kobi5-Aug-07 22:21 
AnswerRe: Take over a GUI of running program Pin
Hessam Jalali6-Aug-07 23:17
Hessam Jalali6-Aug-07 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.