-
I have a class with a public GET and LET to set and retrieve the location of the object. I want to pass a type called LOCATION which has an X and a Y value.
But I always get "Only Public user types declared in public object modules can be used as parameters or return return types for public precedures or class modules... etc"
I've tried declaring the type in the class and/or a public module, I tried public and private but I can't get it to work!
I saw a question like this recently here re activeX controls but I'm not sure if this is related
HELP!
-
could you post a bit of code for us to have a butchers at?
-
sure,
I looked through some of the old posts and found the idea of using "Friend" rather than "Public" which seems to work, which is odd, an in depth explanation would be great!!
Code:
' class props (now with friend, doesn't work with public)
Friend Property Get UnitPosition() As Location
UnitPosition = CurrentLoc
End Property
Friend Property Let UnitPosition(Loc As Location)
CurrentLoc = Loc
End Property
' Type
Public Type Location
X As Integer
Y As Integer
BaseWidth As Integer
End Type