Results 1 to 4 of 4

Thread: illegal use of AddressOf

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    Princeton, New Jersey
    Posts
    46
    Why would it be illegal to use AddressOf in a Class?

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I'm not sure but it wouldn't work, if you have several objects running, how can you address one or them (which one?) And what if you don't have any objects of that class at all?

    It just only works with modules since they are there until your app is terminated
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Guest
    you can only use the AddressOf Operator on Public Functions that you write yourself, that are contained in a class module.

    for example you couldnt use it on an API call, or a private function, or anything inside a form(like Command1_Click)

  4. #4
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    also you have to use AddressOf as a Parameter in a function. for example this

    Code:
    Dim lngAddress as Interger
    
    Private Sub Form_Load()
    
    lngAddress = AddressOf MyFunction
    
    End Sub
    wuld be illegal but this

    Code:
    Private Sub Form_Load()
    
    lngAddress = GetValue(AddressOf MyFunction)
    
    End Sub
    
    Private Function GetValue(Value as Long)
    
    GetValue = Value
    
    End Function
    is fine.

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