Sol W1

Here come your solutions!

Answers to the questions. Add your signature using three tilde signs, to mark your personal answer.

1. remove declaration of sayHello()

Remove the declaration of sayHello() from main() in hello1.cpp. What happens when you try to compile it?

2. remove the include guard

Remove the include guard from the header file sayhello.h and include the file twice in the corresponding main program hello.cpp. Do you expect an error? Do you get one? Why?

3. double inclusion without guard

Perform the same removal of the include guard and double inclusion with the file Hello.h containing the class Hello. Do you expect an error? Do you get one? Why?

4. complie without implementation file

What happens when you compile hello.cpp without the implementation file containing the definition of sayHello()? Can you explain the error message?

5. compile without library required

What happens when you compile hello2.cpp without specifying the library containing the code compiled from sayhello2.cpp?

6. recursion...

Since sayHello() is a function, you can call it from itself (sayhello.cpp). What happens if you call it after the output statement? What happens if you call it in front of the output statement? Why does this happen?

Last edited September 15, 2017