12. [-] void setAge(int age)
13. [ ] iAge = age
14. [-] int getAge()
15. [ ] return iAge
16. [ ] // set and get Name
17. [-] void setName(string name)
18. [ ] sName = name
19. [-] string getName()
20. [ ] return sName
21.[ ]
22.[ ] // class Student inherit from People
23.[-] winclass Student: People
24. [ ] // declare a new data member and set default value for it
25. [ ] string sSex = "Male"
26. [ ] // set and get Sex
27. [-] void setSex(string sex)
28. [ ] sSex = sex
29. [-] string getSex()
30. [ ] return sSex
31. [ ]
32. [ ] // set and get instance
33. [-] void setStudent(Window s)
34. [ ] this.iAge = s.iAge
35. [ ] this.sName = s.sName
文章来源于领测软件测试网 https://www.ltesting.net/