Protokol cepat untuk menghitung area

protocol Polygon {

  func getArea(length: Int, breadth: Int)
}

// conform the Polygon protocol
class Rectangle: Polygon {

  // implementation of method
  func getArea(length: Int, breadth: Int) {
    print("Area of the rectangle:", length * breadth)
  }
}

// create an object
var r1 = Rectangle()

r1.getArea(length:5, breadth: 6)
SAMER SAEID