Advertisement
Guest User

overloading

a guest
Apr 24th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.44 KB | None | 0 0
  1. class Nir
  2. {
  3.     //declare of defualt constructor
  4.     init(){}
  5.     //another constructor
  6.     init(param:String){}
  7.    
  8.     //function sayHi
  9.     func sayHi()
  10.     {
  11.         print ("kill me!!")
  12.     }
  13.    
  14.     func sayHi(by:String)
  15.     {
  16.         print ("me was killed by \(by)")
  17.     }
  18.    
  19.     func sayHi(by:String, moto:String)
  20.     {
  21.         print ("me was killed by \(by) \(moto)")
  22.     }
  23.    
  24. }
  25. var student:Nir=Nir()
  26. student.sayHi()
  27. student.sayHi(by: "Itay")
  28. student.sayHi(by: "Itay", moto:"Today!!!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement