From 4a9de2897c36e1c62f26b9bacf6d24d1477d34af Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Wed, 1 Apr 2020 14:13:55 +0200 Subject: [PATCH] additional info for c++ --- cpp/instances/README.md | 11 +++++++++++ cpp/instances/main.cpp | 4 ++-- lessons/Instances.md | 8 ++++---- 3 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 cpp/instances/README.md diff --git a/cpp/instances/README.md b/cpp/instances/README.md new file mode 100644 index 0000000..da0f2ea --- /dev/null +++ b/cpp/instances/README.md @@ -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) diff --git a/cpp/instances/main.cpp b/cpp/instances/main.cpp index 91ce2a2..b5946d1 100644 --- a/cpp/instances/main.cpp +++ b/cpp/instances/main.cpp @@ -3,11 +3,11 @@ int main() { // create a new car and store it in the variable 'a' - car a; + car a; // set some data for that car a.manufacturer = "Benz"; a.model = "Velo"; - + // do the same for a second car car b; b.manufacturer = "Ford"; diff --git a/lessons/Instances.md b/lessons/Instances.md index 32175c2..6e3f832 100644 --- a/lessons/Instances.md +++ b/lessons/Instances.md @@ -64,7 +64,7 @@ repository :) ## Examples -- [Java](../java/instances) -- [Rust](../rust/instances) -- [C++](../cpp/instances) -- [JavaScript (using TypeScript)](../typescript/instances) +- [Java](../java/instances/README.md) +- [Rust](../rust/instances/README.md) +- [C++](../cpp/instances/README.md) +- [JavaScript (using TypeScript)](../typescript/instances/README.md)