I am reading introduction to Scala paper and found following statement:
It should be noted that some object-oriented languages do not have the concept of class.
Question: Which object-oriented languages do not have class concept and how do they handle type(class) - object(type instance) relationship ?
Notice, however, that nothing about OOP requires classes specifically. A form of OOP can even be implemented in C through the adoption of certain conventions. Classes are but one path to OOP's promise of reusability.
OOP languages are diverse, but the most popular ones are class-based, meaning that objects are instances of classes, which also determine their types. Many of the most widely used programming languages (such as C++, Java, Python, etc.)
There are many programming languages which are not a true object-oriented programming languages like Fortan, Algol, Cobol, Basic, Pascal, C, Ada, and etc.
Encapsulation, inheritance, and polymorphism are usually given as the three fundamental principles of object-oriented languages (OOLs) and object-oriented methodology.
Although it is common in popular languages to conflate them, classes and types are different concepts. A class is properly understood as a blueprint for an object, defining the attributes and methods that instances of the class possess, but an (object) type is an interface, describing what methods can be called with what parameters.
Thus, it is not difficult to imagine languages without classes. All you need is some kind of a construct for creating objects and for giving (new) objects attributes and methods; Javascript is a well known example. Inheritance will look a bit unusual in such languages, but certainly can be done (see for example Antero Taivalsaari's article "On the notion of inheritance").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With