#2
zhangcanwei2017-11-22 07:28
|
imports system
namespace vbnetbook.chapter01
public class stack
dim top as entry
public sub push(byval data as object)
top=new entry(top,data)
end sub
public function pop() as object
if(top is nothing) then
throw new invalidoperationexception()
end if
dim result as object=top.data
top=top.nextdata
return result
end function
class entry
public nextdata as stack.entry
public data as object
Sub New(ByVal nextdata As stack.entry, ByVal data As Object)
Me.nextdata = nextdata
Me.data = data
End Sub
end class
end class
end namespace