![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am reading Markus Egger's "Advanced Object Oriented Programming with Visual FoxPro 6.0". On page 335, he discusses derived attributes/properties and gives some sample code. Unfortunately, it is only a snippet. I put something together myself. This works to the extent of giving me the right answer. Must I define c as a property? (If I have multiple derived red-only properties, I would just as soon not define them.) Without it, I get an error "Property C is not found." Is there another way to do it? I looked at this_access, but the documentation is rather opaque. ********** Start of Included Code ********** * Derived Property o=createobject("derived") o.a=3 o.b=4 ? o.c return define class derived as custom a=.f. b=.f. c=.f. procedure c_access return sqrt(this.a*this.a+this.b*this.b) endproc enddefine ********** End of Included Code ********** Sincerely, Gene Wirchenko Computerese Irregular Verb Conjugation: I have preferences. You have biases. He/She has prejudices. |
#3
| |||
| |||
|
|
Since it's trying to print an object property (?o.c), then "c" must be a property of that class. It must still be defined, even if you just give it a default value. You can't have an _access method unless there's a property for it to access! |
![]() |
| Thread Tools | |
| Display Modes | |
| |