General information
Category:
Coding, syntax & commands
Title:
How to pass parms to custoom classes?
I'm new to the whole visual realm so this may be a rather stupid question; however, its enough to give me a headache.
I'm trying to create a custom class. I want to be able to pass a parameter to it as it's being initialized. I've done the following but I keep getting the error: Function argument value, type, or count invalid.
(Using VFP 7)
***** Class definition in c:\temp\test.prg
define class TstClass as custom
protected tstValue
function Init(cType as string)
= messagebox(cType)
this.tstValue = cType
endfunc
enddefine
***** command line code
oTest = newobject("TstClass","c:\temp\test.prg",,"Value")
Running the above line is when I get my error. The error message hits before the messagebox ever displays. I've even removed the messagebox just to make sure that the error wasn't happening there.
From everything I've read, that should be right. Am I forgetting something? Can you not pass parameters to the Init function? (Everything I've read says you can.)
Thanks for whatever help you can offer!
Rodd
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only