Results 1 to 5 of 5

Thread: little question

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    little question

    Just wondering if there's anything wrong with declaring a class inside another class
    tnx

  2. #2
    Hyperactive Member SoftwareMaker's Avatar
    Join Date
    Mar 2001
    Location
    Elbonia with Dilbert and Wally
    Posts
    322
    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 ?
    William T
    Software Architect / Chief Software Developer
    Softwaremaker.Net Pte Ltd
    http://www.Softwaremaker.net

    *** Things are always the darkest before they go pitch black ***

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    do you mean this:

    Code:
    Class  Class1
         Class Class2
             .......................
         End Class
    End Class
    or do you mean:

    Code:
    Class Class1
        Public myClass As Class2
    
    End Class
    first one is no
    second is yes
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    I'm actually trying the first one 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? because I remember I got an error or something and this is why I decided to declare two classes in each other

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width