OO Eu - Where are Member Variables
Ok, now I'm confused.
I've got the 2.5 installation working fine, and the OO version seems to work
with the class.ex axample, but I'm kinda lost on the documentation!
There seems to be no ability to add Member variables to the euclass - only
Methods. This is not very useful as a class needs to have both - encapsulated
data and the functions that work with said data. All the examples I've seen just
have a few methods which are called, but no examples of using an internal member
variable.
I attempted to do the obvious like below:
euclass person (integer dummy)
-- members
sequence firstname, lastname
integer age, shoesize
atom gender
-- methods
procedure setName(sequence fname, sequence lname)
this.firstname = fname
this.lastname = lname
end procedure
function getFullName()
return this.firstname & " " & this.lastname
end function
function getAgeInDays()
return this.age * 365
end function
end euclass
person jim
jim.setName("Jimmy","Brown")
puts(1, "Hello " & jim.getFullName() )
But I just get an error when trying to run:
Syntax error - expected to see possibly '(', not '='
this.firstname = fname
^
Fatal run-time error:
divide by 0
After even more attempts I got to the point where I had no member variables and
needed to assign a value to the instance of the class (jim = 6) What is the
purpose of giving a class (which is a structure of information) a single value??
Or am I missing something completely?
There really needs to be a lot of small examples available of how all this is
supposed to work - 'Cos it ain't obvious even to a seasoned programmer like me.
I really want to see this become a de-facto standard for OO, so it's gonna need
more support.
Well, time to get back to the beer, cheers.
. .. : :: = == == = :: : .. .
Server-Side DB driven web sites,
Software Development
and part-time games developer
contact dave_p at purpletiger dot com
. .. : :: = == == = :: : .. .
|
Not Categorized, Please Help
|
|