Session 17 Swift IOS Code

IOS Mobile Application Development        

Session 17 Swift IOS Code


// what is Inheritance 
class Point
{
  let x: Int 
  let y: Int 

  init(x: Int, y: Int)
  {
    self.x = x
    self.y = y
  }
}

class NamedPoint: Point
{
let lable: String?

init(x: Int, y: Int, lable: String?)
{
  self.lable = lable
  super.init(x: x, y: y)
}

func abc()
{
  print("\(x)  \(y)")
}
}

let pp = NamedPoint(x: 10, y:45, lable: "FahadHussainCS")
pp.abc()

1 comment:

Fell free to write your query in comment. Your Comments will be fully encouraged.