Sharing subs / functions between classes.

4Steven

New member
Joined
Apr 3, 2012
Messages
1
Programming Experience
Beginner
I am a basically a beginner in vb.net and I have searched and searched and cannot find a reasonable explanation regarding using subs and functions from other classes.

What would be the preferred method to access subs / functions from another class ?
Are there benefits 1 way or another ?

Sharing
Friend Class1
Friend shared myfunction1
end function
End class


or Not sharing the sub / function and using

Friend Class2
Private MyClass1 as new Class1
etc...
end class

or should it be...

Friend Class2
Private MyClass1 as Class1 = new Class1
etc...
end class

Any help is greatly appreciated.

Steven
 
If a member has no instance dependency with the type it is declared in, then it should be declared Shared. Otherwise a Shared declaration is not possible.
 
Back
Top