Questions tagged [classes]
Use this tag for questions about the design or implementation of classes in a programming language, including syntax and functionality.
5
questions
11
votes
1
answer
398
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. ...
10
votes
3
answers
292
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 ...
10
votes
1
answer
339
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
888
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 ...
3
votes
4
answers
158
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 ...