|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
例子1:
class Outer;
int outerProp;
local int outerLocalProp;
static int outerStaticProp;
static local int outerLocalStaticProp;
class Inner;//类Inner为嵌套类
function void innerMethod(Outer h);
//类Outer声明
outerStaticProp = 0;// Legal, same as Outer:uterStaticProp
outerLocalStaticProp = 0;// Legal, nested classes may access local's in outer class
outerProp = 0;// Illegal, unqualified access to non-static outer
h.outerProp = 0;// Legal, qualified access.
h.outerLocalProp = 0;// Legal, qualified access and locals to outer class allowed.
endfunction
endclass
endclass
例子2:
class Packet;
Packet next;
function Packet get_next();// single line
get_next = next;
endfunction
// out-of-body (extern) declaration
extern protected virtual function int send(int value);
endclass
function int Packet::send(int value);
// dropped protected virtual, added Packet::
// body of method
...
endfunction
这是在sv手册中看到的,代码中红色字体的声明应该怎么理解或者解释?
像例子1中红色字体的声明,如果它的位置位于类中其他成员变量定义的前面,还能像例子中的那种方式引用吗? |
|