Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you create a class in Wollok?

Tags:

oop

wollok

I want to know if it's possible to define a class with some sort of constructor or if I have to initialize every field by hand.

like image 941
Nicolás Scarcella Avatar asked Mar 05 '16 14:03

Nicolás Scarcella


1 Answers

Constructors in wollok are defined using the 'constructor' keyword. For example:

class Point {
    var x
    var y

    constructor(_x, _y) {
        x = _x
        y = _y
    }
}
like image 170
Nico Passerini Avatar answered Oct 18 '22 20:10

Nico Passerini