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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- FROM JAVA BUILDERS TO KOTLIN DSLSJavaUIKotlin
- LeetCode之Construct String from Binary Tree(Kotlin)LeetCodeStructKotlin
- LeetCode之All Paths From Source to Target(Kotlin)LeetCodeKotlin
- Microsoft Office 2003 Web ComponentsROSWeb
- How to redirect to a specific web page after sign out from Entra IDWeb
- From Java To Kotlin:空安全、擴充套件、函式、Lambda很詳細,這次終於懂了JavaKotlin套件函式
- Javalin2.4.0釋出,Kotlin/Java輕量級Web框架JavaKotlinWeb框架
- 從零開始, 開發一個 Web Office 套件 (3): 滑鼠事件Web套件事件
- Web Office 套件(8):狀態管理 & 拖動滑鼠選中文字Web套件
- Office 2019 office辦公套件套件
- From now on
- casid/jte:用於Java和Kotlin的Jsp/Java的Web模板引擎JavaKotlinJSWeb
- 【Kotlin】Kotlin環境搭建Kotlin
- 【Kotlin】初識Kotlin(二)Kotlin
- 從零開始,開發一個 Web Office 套件(6):游標 & Click 事件Web套件事件
- 從零開始,開發一個 Web Office 套件(5):Mouse hover over textWeb套件
- 神From不再 From Software的內憂與外患
- Office LTSC 2021 for Mac(office系列全套裝)Mac
- Microsoft Office 2019 for Mac office系列全套裝ROSMac
- from cmake make
- Array.from()
- Office公式公式
- Office 2021
- Office Phishing
- office技巧
- Extract rows from a CORRUPT table creating ROWID from DBA_EXTENTS
- Office LTSC 2021 for Mac(office)16.77啟用版Mac
- 使用 Office Tool Plus 免費啟用 Office
- Microsoft Office 2013與WPS Office 2013對比ROS
- office文件恢復軟體(magic office recovery)
- 從零開始, 開發一個 Web Office 套件 (2): 富文字編輯器Web套件
- 從零開始, 開發一個 Web Office 套件 (1): 富文字編輯器Web套件
- 從 Java 到 Kotlin - 介紹 KotlinJavaKotlin
- [Kotlin基礎] Java 呼叫 Kotlin(一)KotlinJava
- office全家桶Office 2019 for Mac下載附office2019永 久啟用工具Mac
- Microsoft Office 2019 for Mac(附Office啟用金鑰)ROSMac
- office 2010 金鑰 office 2010永久的金鑰
- from bson import ObjectIdImportObject