FratmScript 🤌🏻

Classes

na famiglie Name { … } declares a class (class). The costruttore(…) sets the object up and nu bell Name(…) creates a new one (new).

figlio 'e inherits from another class (extends) and 'o pate calls the parent class (super). fisso makes a method static (static), damme and miette create getters and setters. Fields starting with # are private.

na famiglie Persona {
    costruttore(nome) {
        stu cos.nome = nome
    }

    saluta() {
        piglie "Uè, so' " + stu cos.nome
    }
}

na famiglie Pizzaiolo figlio 'e Persona {
    #pizze = 0

    costruttore(nome) {
        'o pate(nome)
    }

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

    damme pizze() {
        piglie stu cos.#pizze
    }

    fisso mestiere() {
        piglie "pizzaiolo"
    }
}

chist è gennaro = nu bell Pizzaiolo("Gennaro")
gennaro.sforna()
gennaro.sforna()
stamm a dì(gennaro.saluta(), gennaro.pizze)
stamm a dì(Pizzaiolo.mestiere(), gennaro è uno Persona)

Output

Uè, so' Gennaro 2
pizzaiolo true

Try this section in the playground