The below example shows how to use local struct fields for writing method using e-language.
Ex : file_name : packet.e
<’
struct packet_s {
length: uint (bits; 6);
legal_value(): bool is {
if (length >= 64) then {
return (TRUE);
};
}; // end of method
// extend the pre-defined method to call the local method
run() is also {
// call the method declared
legal_value();
}; // end of run() method
};
‘>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment