属性操作很像公共变量,但属性还有更多的控制。
常用属性通常包括"get(获取)"和"let(设置)"两种。这两项操作能规定一个主要属性,就像下面的代码片段:
| private intage as integer public property get age() as integer age = intage end property public property let age(byval vnewvalue as integer) intage = vnewvalue end property |
| mydog.age = 4 |
| msgbox mydog.age |
| face="courier" size=2> private intage as integer public property get age() as integer age = intage end property public property let age(byval vnewvalue as integer) if vnewvalue <= 50 then intage = vnewvalue end if end property |
| mydog.age=30 |
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器