diff --git a/cpp/instances/main.cpp b/cpp/instances/main.cpp index b5946d1..e848151 100644 --- a/cpp/instances/main.cpp +++ b/cpp/instances/main.cpp @@ -3,6 +3,7 @@ int main() { // create a new car and store it in the variable 'a' + // in contrast to java, c++ does not need initialization with the 'new' keyword here. car a; // set some data for that car a.manufacturer = "Benz"; diff --git a/java/instances/Car.java b/java/instances/Car.java index b616316..768db93 100644 --- a/java/instances/Car.java +++ b/java/instances/Car.java @@ -1,4 +1,4 @@ -/* +/* Basic Car class just here to make the demonstration in the main file possible diff --git a/java/instances/README.md b/java/instances/README.md new file mode 100644 index 0000000..b9f28d6 --- /dev/null +++ b/java/instances/README.md @@ -0,0 +1,5 @@ +# Java Example + +Relevant Files: + +- [main.java](./main.java) diff --git a/rust/instances/README.md b/rust/instances/README.md new file mode 100644 index 0000000..dc91a94 --- /dev/null +++ b/rust/instances/README.md @@ -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) diff --git a/rust/instances/src/main.rs b/rust/instances/src/main.rs index 6a27d96..a7b4252 100644 --- a/rust/instances/src/main.rs +++ b/rust/instances/src/main.rs @@ -3,6 +3,8 @@ use car::Information; fn main() { // 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 { // set some data for that car manufacturer: "Benz".to_string(), diff --git a/typescript/instances/README.md b/typescript/instances/README.md new file mode 100644 index 0000000..4da9c61 --- /dev/null +++ b/typescript/instances/README.md @@ -0,0 +1,5 @@ +# Typescript Example + +Relevant Files + +- [index.ts](./index.ts)