Infix:from the office web of Kotlin
The use of infix:from the office web of Kotlin
* Functions marked with the infix keyword can also be called using the infix notation * (omitting the dot and the parentheses for the call). Infix functions must satisfy the * following requirements:They must be member functions or extension functions;They must * have a single parameter;The parameter must not accept variable number of arguments and * must have no default value. * infix fun Int.shl(x: Int): Int { ... } * // calling the function using the infix notation * 1 shl 2 * // is the same as * 1.shl(2) requirements: 1.They must be member functions or extension functions; 2.They must have a single parameter; 3.The parameter must not accept variable number of arguments and must have no default value.*/fun main(args: Array<String>) { var v1 = Plo() var v2 = Plo() v2 call v1 infix fun Int.shl(x:Int):Int{ return 2 } println(1 shl 2)//4}class Plo(){ infix fun call(n: Plo){ println("Hello i'm 齊德龍東強")//Hello i'm 齊德龍東強 } }
作者:藍Renly
連結:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/132/viewspace-2817517/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Kotlin-48.JavaScript呼叫Kotlin(Call Kotlin from JavaScript)KotlinJavaScript
- FROM JAVA BUILDERS TO KOTLIN DSLSJavaUIKotlin
- Scala的Infix Type與Self Types
- LeetCode之All Paths From Source to Target(Kotlin)LeetCodeKotlin
- Advance Web Solutions---Office MessengerWebMessenger
- LeetCode之Construct String from Binary Tree(Kotlin)LeetCodeStructKotlin
- Microsoft Office 2003 Web ComponentsROSWeb
- Web版Office2010搶先評測Web
- Web方式預覽Office/Word/Excel/pdf檔案解決方案WebExcel
- eclise 部署web工程報 There are no resources that can be added or removed from the server.WebREMServer
- How to redirect to a specific web page after sign out from Entra IDWeb
- How to open MS word document from the SharePoint 2010 using Microsoft.Office.Interop.dllROS
- From Java To Kotlin:空安全、擴充套件、函式、Lambda很詳細,這次終於懂了JavaKotlin套件函式
- Web Office 套件(8):狀態管理 & 拖動滑鼠選中文字Web套件
- 從零開始, 開發一個 Web Office 套件 (3): 滑鼠事件Web套件事件
- Javalin2.4.0釋出,Kotlin/Java輕量級Web框架JavaKotlinWeb框架
- NeoOffice for Mac(office辦公軟體)Mac
- LibreOffice for Macoffice辦公套件Mac套件
- LibreOffice for Mac(Office辦公套件)Mac套件
- 【Kotlin】初識Kotlin(二)Kotlin
- Dive Into Kotlin(一):初探 KotlinKotlin
- 【Kotlin】Kotlin環境搭建Kotlin
- onlyOffice
- Office公式公式
- 從零開始,開發一個 Web Office 套件(6):游標 & Click 事件Web套件事件
- 從零開始,開發一個 Web Office 套件(5):Mouse hover over textWeb套件
- office文件恢復軟體(magic office recovery)
- Office 2019 office辦公套件套件
- WPS Office和微軟Office精確相容微軟
- 使用 Office Tool Plus 免費啟用 Office
- 從零開始, 開發一個 Web Office 套件 (2): 富文字編輯器Web套件
- 從零開始, 開發一個 Web Office 套件 (1): 富文字編輯器Web套件
- office辦公套件:NeoOffice有哪些特點套件
- Office LTSC 2021 for Mac(office系列全套裝)Mac
- 借力QuickOffice 谷歌偷襲微軟OfficeUI谷歌微軟
- Office處理
- OFFICE快速全屏
- 從 Java 到 Kotlin - 介紹 KotlinJavaKotlin