Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Pracownik(val nazwisko: String)
- {
- private var _zwolniony: Boolean = false
- Pracownik._liczbaPracownikow+=1
- def zwolnij { Pracownik._liczbaPracownikow-=1; _zwolniony = true }
- override def toString = nazwisko + " : " + (if(_zwolniony) "zwolniony" else "nie zwolniony")
- }
- object Pracownik {
- private var _liczbaPracownikow: Int = 0
- def liczbaPracownikow = _liczbaPracownikow
- }
- object Test {
- def main(args: Array[String]) {
- val pt = new Pracownik("chuj");
- println(pt.toString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement