“Kontrol akses cepat” Kode Jawaban

Kontrol akses cepat

class Student {

  // private property
  private var name = "Tim Cook"

  // private method    
  private func display() {
    print("Hello from Student class")
  }
}

// create object of Student class
var student1 = Student()
    
// access name property
print("Name:", student1.name)

// access display() method 
student1.display()
SAMER SAEID

Kontrol akses cepat

class Vehicle {

  public func method1() {...}
  private func method2() {...}
}
SAMER SAEID

Jawaban yang mirip dengan “Kontrol akses cepat”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya