Questions tagged [classes]
Use this tag for questions about the design or implementation of classes in a programming language, including syntax and functionality.
6 questions
6 votes
1 answer
483 views
Are there OO languages which implement objects as persistent data-structures?
I am an object-oriented developer professionally, but I have researched functional programming and (believe that) I understand the key principles which to varying degrees are applied in FP languages. ...
11 votes
1 answer
988 views
Typeclasses, traits, interfaces, protocols: is there any consistent terminology?
Many languages have some form of expressing "user-defined duck typing": defining a type by its behavior, rather than anything about the structure or data of an instance of the type itself. ...
11 votes
3 answers
404 views
What are the advantages/disadvantages of making every class an instance of an Object superclass?
In some languages, all classes have an implicit superclass. For example, Object in Java/Python and Any in Kotlin. All classes ...
11 votes
1 answer
553 views
What are the different class-like constructs that languages use today?
Taking this question to its logical extreme. Some languages like C++ and Python use class for everything. Python classes are classes, interfaces (both nominal and ...
8 votes
7 answers
2k views
Distinguishing classes from structures
Some languages have a concept of classes separately than structs. In C++ the only difference is whether the members are public or private by default. This seems redundant. Why have a separate ...
2 votes
4 answers
470 views
What is the purpose of requiring class-based programming?
Some languages such as Java and C# (since last I checked) require all functions to be inside of a class. Some simple programs are procedural by design, such as command line tools. And requiring a ...