fbpx
维基百科

方法级联调用

方法级联调用(Method cascading)是面向对象编程语言中对同一个对象调用其多个方法时的一种语法糖。特别适用于实现流畅接口[1]

例如在Dart语言中:

a..b()  ..c(); 

等价于单独调用:

a.b(); a.c(); 

Visual Basic允许对同一个对象调用任意多次的方法或属性:[2]

With ExpressionThatReturnsAnObject .SomeFunction(42) .Property = value End With

With..End With块在Visual Basic中可以嵌套:

With ExpressionThatReturnsAnObject .SomeFunction(42) .Property = value With .SubObject .SubProperty = otherValue .AnotherMethod(42) End With End With

参见 编辑

参考文献 编辑

  1. ^ Beck, Kent. Smalltalk Best Practice Patterns. Prentice Hall. 1997. ISBN 978-0134769042. 
  2. ^ With statement in MSDN. [2022-10-13]. (原始内容于2022-09-06). 

方法级联调用, 此條目可参照英語維基百科相應條目来扩充, 若您熟悉来源语言和主题, 请协助参考外语维基百科扩充条目, 请勿直接提交机械翻译, 也不要翻译不可靠, 低品质内容, 依版权协议, 译文需在编辑摘要注明来源, 或于讨论页顶部标记, href, template, translated, page, html, title, template, translated, page, translated, page, 标签, method, cascading, 是面向对象编程语言中对同一个对象调用其多个方法时. 此條目可参照英語維基百科相應條目来扩充 若您熟悉来源语言和主题 请协助参考外语维基百科扩充条目 请勿直接提交机械翻译 也不要翻译不可靠 低品质内容 依版权协议 译文需在编辑摘要注明来源 或于讨论页顶部标记 a href Template Translated page html title Template Translated page Translated page a 标签 方法级联调用 Method cascading 是面向对象编程语言中对同一个对象调用其多个方法时的一种语法糖 特别适用于实现流畅接口 1 例如在Dart语言中 a b c 等价于单独调用 a b a c Visual Basic允许对同一个对象调用任意多次的方法或属性 2 With ExpressionThatReturnsAnObject SomeFunction 42 Property value End With With End With块在Visual Basic中可以嵌套 With ExpressionThatReturnsAnObject SomeFunction 42 Property value With SubObject SubProperty otherValue AnotherMethod 42 End With End With参见 编辑流式接口 管道 Unix Nesting computing 英语 Nesting computing 生成器模式 诅咒金字塔 编程 方法链式调用参考文献 编辑 Beck Kent Smalltalk Best Practice Patterns Prentice Hall 1997 ISBN 978 0134769042 With statement in MSDN 2022 10 13 原始内容存档于2022 09 06 取自 https zh wikipedia org w index php title 方法级联调用 amp oldid 74807473, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。