Compare commits

..

2 Commits

Author SHA1 Message Date
551e8835d7 extra info for other languages 2020-04-01 15:29:10 +02:00
4a9de2897c additional info for c++ 2020-04-01 14:13:55 +02:00
8 changed files with 41 additions and 7 deletions

11
cpp/instances/README.md Normal file
View File

@ -0,0 +1,11 @@
# C++ Example
## Language Specific
c++ is almost identical to java in this example.
The only difference here is that c++ doesn't require the object
to be initialized with the keyword 'new'.
Relevant Files:
- [main.cpp](./main.cpp)

View File

@ -3,11 +3,12 @@
int main() { int main() {
// create a new car and store it in the variable 'a' // create a new car and store it in the variable 'a'
car a; // in contrast to java, c++ does not need initialization with the 'new' keyword here.
car a;
// set some data for that car // set some data for that car
a.manufacturer = "Benz"; a.manufacturer = "Benz";
a.model = "Velo"; a.model = "Velo";
// do the same for a second car // do the same for a second car
car b; car b;
b.manufacturer = "Ford"; b.manufacturer = "Ford";

View File

@ -1,4 +1,4 @@
/* /*
Basic Car class Basic Car class
just here to make the demonstration in the main file possible just here to make the demonstration in the main file possible

5
java/instances/README.md Normal file
View File

@ -0,0 +1,5 @@
# Java Example
Relevant Files:
- [main.java](./main.java)

View File

@ -64,7 +64,7 @@ repository :)
## Examples ## Examples
- [Java](../java/instances) - [Java](../java/instances/README.md)
- [Rust](../rust/instances) - [Rust](../rust/instances/README.md)
- [C++](../cpp/instances) - [C++](../cpp/instances/README.md)
- [JavaScript (using TypeScript)](../typescript/instances) - [JavaScript (using TypeScript)](../typescript/instances/README.md)

10
rust/instances/README.md Normal file
View File

@ -0,0 +1,10 @@
# Rust Example
## Language specific
- 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.
Relevant Files
- [main.rs](./src/main.rs)

View File

@ -3,6 +3,8 @@ use car::Information;
fn main() { fn main() {
// create a new car and store it in the variable 'a' // create a new car and store it in the variable 'a'
// rust also doesn't use the 'new' keyword
// all attributes have to be defined upon creation of the object
let a = car::Car { let a = car::Car {
// set some data for that car // set some data for that car
manufacturer: "Benz".to_string(), manufacturer: "Benz".to_string(),

View File

@ -0,0 +1,5 @@
# Typescript Example
Relevant Files
- [index.ts](./index.ts)