FratmScript 🤌🏻

Lesson 9 / 14

na famiglie

na famiglie Name { … } creates a class. The costruttore sets up the object, and stu cos is the object itself (this).

nu bell Name(…) creates a new object (new). With figlio 'e a class inherits from another one (extends).

Exercise

Add a method presentati() that returns "Songo " + the name, and print only gennaro.presentati().

na famiglie Pizzaiolo {
    costruttore(nome) {
        stu cos.nome = nome
        stu cos.pizze = 0
    }

    sforna() {
        stu cos.pizze++
        piglie stu cos.pizze
    }
}

chist è gennaro = nu bell Pizzaiolo("Gennaro")
stamm a dì(gennaro.sforna(), gennaro.sforna())

When you are done, the program prints

Songo Gennaro

Do this lesson in the playground