Shamil Salakhetdinov
shamil at smsconsulting.spb.ru
Sat Nov 5 14:25:52 CDT 2011
John -- Sorry, I don't know what to say/advise here - I don't understand the reasoning... I personally routinely use inheritance or composition or delegation, and I usually do not care that much about scope: I do keep most of the stuff private or protected, and when needed I do make it internal or public... 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 ?. 20:16 To: Discussion concerning Visual Basic and related programming issues. Subject: Re: [dba-VB] C# Scope The problem that I have here is that the RunState class can potentially be used by any other class. The point of the RunState class is to encapsulate all of the stuff to define a RunState state machine, and any complex class can have a RunState. In fact some of my classes have several RunState classes. 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. > > _______________________________________________ dba-VB mailing list dba-VB at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/dba-vb http://www.databaseadvisors.com