classes
This commit is contained in:
@ -1,14 +1,25 @@
|
||||
# Creating Classes
|
||||
|
||||
This lesson is going to use the same code from last time to explain
|
||||
the class structure itself.
|
||||
This lesson is going to use the same code from last time to explain the class
|
||||
structure itself.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
## 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)
|
||||
|
Reference in New Issue
Block a user