26 lines
1.0 KiB
Markdown
Raw Permalink Normal View History

2020-04-03 10:47:05 +02:00
# Creating Classes
2020-05-03 15:12:03 +02:00
This lesson is going to use the same code from last time to explain the class
structure itself.
2020-04-03 10:47:05 +02:00
2020-05-03 15:12:03 +02:00
Since the example languages can have quite different styles of class
declaration, I will just give a basic explanation here and then discuss every
language in detail in their own description file.
2020-04-03 10:47:05 +02:00
2020-05-03 15:12:03 +02:00
Classes are blueprints for the objects you create. You define how the object
will look like and more importantly for the computer how much space it will use
in memory.
2020-04-03 10:47:05 +02:00
2020-05-03 15:12:03 +02:00
The main parts of a class are fields and methods. One for storing data and one
for processing that data. Fields are placed at the top of the class and look
like general variable declarations. Methods can take in arguments and also use
the fields declared in the class. They can modify data in the object or just
return some data to the caller.
2020-04-03 10:47:05 +02:00
2020-05-03 15:12:03 +02:00
## Code examples and language specific explanations
- [Java](../java/classes/README.md)
- [Rust](../rust/classes/README.md)
- [C++](../cpp/classes/README.md)
- [JavaScript (using TypeScript)](../typescript/classes/README.md)