|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Why does a private implementation of ICloneable work?function and it works? e.g. Imports System Public Class BusinessObject Implements ICloneable Private Function privateClone() As Object Implements ICloneable.Clone Dim MyClone As Object = makeClone() Return MyClone End Function End Class Does that fact that the Clone is public on ICloneable mean that the "private" above is ignored when the object is being dealt with as type ICloneable? The modify tag, private, does not apply to the compiler. It is capable of
calling the method. The tag is applicable only to calling code. -- Show quoteWarm Regards, Alvin Bruney [MVP ASP.NET] [Shameless Author plug] The Microsoft Office Web Components Black Book with .NET Now Available @ www.lulu.com/owc Professional VSTO 2005 - Wrox/Wiley 2006 Blog: http://msmvps.com/blogs/Alvin/ ------------------------------------------------------- "cmay" <c***@walshgroup.com> wrote in message news:1144679199.957344.262490@g10g2000cwb.googlegroups.com... > Can someone explain why you can implement ICloneable with a private > function and it works? > > e.g. > > Imports System > Public Class BusinessObject > Implements ICloneable > > Private Function privateClone() As Object Implements > ICloneable.Clone > Dim MyClone As Object = makeClone() > Return MyClone > End Function > > End Class > > Does that fact that the Clone is public on ICloneable mean that the > "private" above is ignored when the object is being dealt with as type > ICloneable? > IMO it is still called throught IClonable.Clone which is public and that in
turns call the private function. Lutz Reflector should help to find out what goes on behind the scene : http://www.aisto.com/roeder/dotnet/ -- Patrice "cmay" <c***@walshgroup.com> a écrit dans le message de news: 1144679199.957344.262***@g10g2000cwb.googlegroups.com...Show quote > Can someone explain why you can implement ICloneable with a private > function and it works? > > e.g. > > Imports System > Public Class BusinessObject > Implements ICloneable > > Private Function privateClone() As Object Implements > ICloneable.Clone > Dim MyClone As Object = makeClone() > Return MyClone > End Function > > End Class > > Does that fact that the Clone is public on ICloneable mean that the > "private" above is ignored when the object is being dealt with as type > ICloneable? > |
|||||||||||||||||||||||