Advertisement
Guest User

Untitled

a guest
Jan 11th, 2015
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.50 KB | None | 0 0
  1. class Pracownik(val nazwisko: String)
  2. {
  3.     private var _zwolniony: Boolean = false
  4.     Pracownik._liczbaPracownikow+=1
  5.     def zwolnij { Pracownik._liczbaPracownikow-=1; _zwolniony = true }
  6.     override def toString = nazwisko + " : " + (if(_zwolniony) "zwolniony" else "nie zwolniony")
  7. }
  8.  
  9. object Pracownik {
  10.     private var _liczbaPracownikow: Int = 0
  11.     def liczbaPracownikow = _liczbaPracownikow
  12. }
  13.  
  14. object Test {
  15.     def main(args: Array[String]) {
  16.         val pt = new Pracownik("chuj");
  17.         println(pt.toString());
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement