[dba-VB] C# Scope

jwcolby jwcolby at colbyconsulting.com
Sat Nov 5 12:11:52 CDT 2011


Thanks Shamil.  When you say "class library" do you mean a container module?

John W. Colby
Colby Consulting

Reality is what refuses to go away
when you do not believe in it

On 11/5/2011 12:56 PM, Shamil Salakhetdinov wrote:
> John,
>
> If you put class runState and class myClassParent in one class library and
> class myGrandParent in another class library referencing the first one then
> the following code would be the scoping solution you're looking for:
>
> ==== classlib1 ====
> public class runState
> {
>     public ... mStart() {...}
>     internal ... mStarted() {...}
> }
>
> public class myClassParent
> {
>      runState myRunState
> }
>
> ===== classlib2 ===
>
> public class myGrandParent
> {
> 	myClassParent MyClassParent;
> }
>
> Thank you.
>
> --
> Shamil
>
> -----Original Message-----
> From: dba-vb-bounces at databaseadvisors.com
> [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
> Sent: 5 ?????? 2011 ?. 19:30
> To: VBA
> Subject: [dba-VB] C# Scope
>
> Suppose I have a set of classes:
>
> class runState
> {
> 	mStart()
> 	{
> 	}
> 	
> 	mStarted()
> 	{
> 	}
> }
>
> class myClassParent
> {
> 	runState myRunState;
> 	
> }
>
> class myGrandParent
> {
> 	myClassParent MyClassParent;
> }
>
> Is there any way to scope runState.mStarted to be visible to MyClassParent
> but not visible to the grandparent while making runState.mStart visible to
> MyClassParent and MyClassGrandparent?
>
> In other words the grandparent should be able to call the parent's
> runState.mStart but not be able to call the runState.mStarted.  Only the
> parent should be able to call runState.MStarted.
>
>



More information about the dba-VB mailing list