第二章 IRIS 编程简介 - 同时使用类和例程
同时使用类和例程
在 IRIS 中,可以使用例程中的类。例如,下面显示了例程的一部分,其中我们引用了 Sample.Employee 类:
//get details of random employee and print them
showemployee() public {
set rand=$RANDOM(10)+1 ; rand is an integer in the range 1-10
write "Your random number: "_rand
set employee=##class(Sample.Employee).%OpenId(rand)
do employee.PrintEmployee()
write !,"This employee's salary: "_employee.Salary
}
类似地,方法可以调用例程中的标签。例如,以下代码调用例程employeeutils中的标签ComputeRaise:
Method RaiseSalary() As %Numeric
{
set newsalary=$$ComputeRaise^employeeutils(.


.png)
.png)

.png)
.png)


.png)

