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?
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?
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@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@swift.org
https://lists.swift.org/mailman/listinfo/swift-users