Questions tagged [classes]

Use this tag for questions about the design or implementation of classes in a programming language, including syntax and functionality.

Filter by
Sorted by
Tagged with
10 votes
1 answer

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 ...
11 votes
1 answer

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

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 ...
8 votes
7 answers

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

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 ...