注册 登录
编程论坛 VB.NET论坛

该类的成员有该类的对象,怎么理解,怎么有死循环的感觉,可上机调试有没问题.拜托!

秉烛夜游 发布于 2017-11-21 15:33, 1806 次点击
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
1 回复
#2
zhangcanwei2017-11-22 07:28
没有用过嵌套类。我感觉是嵌套引起的
1