(10) Pure Object Orientation

(10) Pure Object Orientation

About

:octocat: GitHub: All of the example code: repo (link)

:page_facing_up: blog link: https://purrgramming.life/cs/programming/fp/ :star:


Intro

A pure object-oriented language is one in which every value is an object.

If the language is based on classes, i.e. the type of each value is a class.

Is Scala a pure object-oriented language?

It is a pure object-oriented language because every value is an object. Types and behaviour of objects are described by classes.

Details

All values, including instances of primitive types and functions, are objects in Scala.

Conceptually, types such as Int or Boolean do not receive special treatment in Scala. They are like the other classes, defined in the package scala.

Java vs Scala

In short, Java is not a pure object-oriented programming language because it supports primitive data types, and everything is not an object in Java.

Examples

See how to define Booleans and Functions as a class in this Link

Leave a Reply

Your email address will not be published. Required fields are marked *