[swift-users] Why don't I use SelfB

Josh Parmenter jparmenter at vectorform.com
Thu Aug 25 10:15:23 CDT 2016


self is lower case to reference the instance.
Hope that helps.
Josh

> On Aug 25, 2016, at 8:10 AM, 김찬홍 via swift-users <swift-users at swift.org> wrote:
> 
> This is my class...
> 
> class Human {
>   static var singCount = 0
>   func sing() {
>     print("Lalala")
>     type(of: self).singCount += 1
>   }
> 
> I wanna use 
>    Self.singCount += 1
> but I can't use it. Why compiler complain use of Self?
> _______________________________________________
> swift-users mailing list
> swift-users at swift.org
> https://lists.swift.org/mailman/listinfo/swift-users



More information about the swift-users mailing list