formatting
This commit is contained in:
parent
d30589c5ad
commit
d6f2d44eaf
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
## Language Specific
|
## Language Specific
|
||||||
|
|
||||||
c++ is almost identical to java in this example.
|
c++ is almost identical to java in this example. The only difference here is
|
||||||
The only difference here is that c++ doesn't require the object
|
that c++ doesn't require the object to be initialized with the keyword 'new'.
|
||||||
to be initialized with the keyword 'new'.
|
|
||||||
|
|
||||||
Relevant Files:
|
Relevant Files:
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
# Classes in C++
|
# Classes in C++
|
||||||
|
|
||||||
In c++ classes are defined using a header file and the implementation in a
|
In c++ classes are defined using a header file and the implementation in a
|
||||||
regular .cpp file. Explanations to the structure can be found in the files themselves
|
regular .cpp file. Explanations to the structure can be found in the files
|
||||||
|
themselves
|
||||||
|
|
||||||
## Relevant files
|
## Relevant files
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@ Objects are generally used to keep data logically grouped and also make it easy
|
|||||||
to perform actions on them without having to account for all the logic at the
|
to perform actions on them without having to account for all the logic at the
|
||||||
time of using those functions.
|
time of using those functions.
|
||||||
|
|
||||||
As an example I have created a Car class. This is probably going to be the
|
As an example I have created a Car class. This is probably going to be the main
|
||||||
main class used in all further lessons, since it has a lot of room for more data
|
class used in all further lessons, since it has a lot of room for more data and
|
||||||
and functions to add except for manufacturer, model and the function print_info
|
functions to add except for manufacturer, model and the function print_info in
|
||||||
in this example.
|
this example.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
/*
|
/*
|
||||||
@ -47,7 +47,8 @@ a.print_info();
|
|||||||
b.print_info();
|
b.print_info();
|
||||||
```
|
```
|
||||||
|
|
||||||
The above example code together with the car class will create the following output:
|
The above example code together with the car class will create the following
|
||||||
|
output:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
Car Information:
|
Car Information:
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
## Language specific
|
## Language specific
|
||||||
|
|
||||||
- Rust doesn't use the 'new' keyword
|
- Rust doesn't use the 'new' keyword
|
||||||
- Classes in Rust require all attributes to be defined at all times, so you have to define all the data on creation.
|
- Classes in Rust require all attributes to be defined at all times, so you have
|
||||||
|
to define all the data on creation.
|
||||||
|
|
||||||
Relevant Files
|
Relevant Files
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user