Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Rexx Creating Multiple Objects

/* Main program */ 
st = .student~new 
st~StudentID = 1 
st~StudentName = 'Joe' 
st~Marks1 = 10 
st~Marks2 = 20 
st~Marks3 = 30 
total = st~Total(st~Marks1,st~Marks2,st~Marks3) 
say total  

st1  =  .student~new 
st1~StudentID = 2 
st1~StudentName = 'John' 
st1~Marks1 = 10 
st1~Marks2 = 20 
st1~Marks3 = 40 
total = st1~Total(st1~Marks1,st1~Marks2,st1~Marks3) 
say total  

st2  =  .student~new 
st2~StudentID = 3 
st2~StudentName = 'Mark' 
st2~Marks1 = 10 
st2~Marks2 = 20 
st2~Marks3 = 30 
total = st2~Total(st2~Marks1,st2~Marks2,st2~Marks3) 
say total  

exit 0 
::class student 
::attribute StudentID 
::attribute StudentName 
::attribute Marks1 
::attribute Marks2 
::attribute Marks3 
::method 'Total' 
use arg a,b,c 
return (ABS(a) + ABS(b) + ABS(c)) 

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.