Skip to content

Commit

Permalink
Add a few comments to the hello world example.
Browse files Browse the repository at this point in the history
  • Loading branch information
poletti-marco committed Jun 21, 2014
1 parent 501728b commit eadb5f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public:

class StdoutWriter : public Writer {
public:
// Like "StdoutWriter() = default;" but also marks this constructor as the
// one to use for injection.
INJECT(StdoutWriter()) = default;

virtual ~StdoutWriter() = default;
Expand All @@ -83,6 +85,8 @@ private:
Writer* writer;

public:
// Like "GreeterImpl(Writer* writer) {...}" but also marks this constructor
// as the one to use for injection.
INJECT(GreeterImpl(Writer* writer))
: writer(writer) {
}
Expand Down Expand Up @@ -110,6 +114,8 @@ int main() {
}
```
More documentation is coming soon, stay tuned.
### Example code
For examples on how code looks like when using Fruit, look at the examples/ directory in the source tree.
Expand Down
4 changes: 4 additions & 0 deletions examples/hello_world/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class Writer {

class StdoutWriter : public Writer {
public:
// Like "StdoutWriter() = default;" but also marks this constructor as the
// one to use for injection.
INJECT(StdoutWriter()) = default;

virtual ~StdoutWriter() = default;
Expand All @@ -31,6 +33,8 @@ class GreeterImpl : public Greeter {
Writer* writer;

public:
// Like "GreeterImpl(Writer* writer) {...}" but also marks this constructor
// as the one to use for injection.
INJECT(GreeterImpl(Writer* writer))
: writer(writer) {
}
Expand Down

0 comments on commit eadb5f7

Please sign in to comment.