Category Archives: JS++

JS++ | Subtype Polymorphism

Subtyping describes type relationships, and subtype polymorphism enables operations defined for supertypes to be safely substituted with subtypes. Concretely, imagine the relation between a ‘Cat’… Read More »

JS++ | Virtual Methods

As we mentioned in the previous section, if we want runtime polymorphism, using casts can lead to unclean code. By way of example, let’s change… Read More »

JS++ | Inheritance

So far, the only type of animal we’ve defined is a cat (via the ‘Cat’ class). Our ‘Cat’ class also requires us to name our… Read More »

JS++ | Constructors

In our cat example, we’ve been able to instantiate our cat and provide a name separately. However, it may be desirable to require the cat… Read More »

JS++ | Fields and Methods

Creating and Rendering an Animal Open ‘src/Animals/Cat.jspp’ and enter the following code: external $; module Animals { class Cat { void render() { var $element… Read More »