PDA

Click to See Complete Forum and Search --> : little question


MrPolite
Feb 22nd, 2002, 12:32 AM
Just wondering if there's anything wrong with declaring a class inside another class:rolleyes: :)
tnx

SoftwareMaker
Feb 22nd, 2002, 01:43 AM
No there is nothing wrong with declaring a class in another class. When you declare a ADO.NET resultset class in one of your classes, arent you already doing that :) ?

Cander
Feb 22nd, 2002, 08:41 AM
do you mean this:


Class Class1
Class Class2
.......................
End Class
End Class



or do you mean:


Class Class1
Public myClass As Class2

End Class



first one is no
second is yes

MrPolite
Feb 22nd, 2002, 12:05 PM
I'm actually trying the first one:D :D I dont know, maybe there's a better way to do this. The thing is that I want to use a class in one of my classes, but I don't want the public to access that inner class. But you say that's a no, tell me what to do then :)

oh well, I dont have VB right now, but can I just declare a private class in a namespace? :D because I remember I got an error or something and this is why I decided to declare two classes in each other:confused: :( :D ;) :p

Cander
Feb 22nd, 2002, 12:30 PM
Easy Make the functionailty of the class all Friend


Friend Sub mySub

that way it can only be accessed by the app it is in.

I think you can declare a class with Friend..try it


Friend Classs Class1


End Class