Corrected / Improved C++ roadmap (#5947)
Updated c++ content with `std::` as this is the recommended method. Added content links where needed and corrected various wording and grammar.
This commit is contained in:
1 parent
7d694f3e56
commit
e4d106904e
13 files changed
+57
-62
No files matched your search
+4
-5
@@ -10,18 +10,17 @@ Here's an example illustrating function overloading:
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
void print(int num) {
|
||||
cout << "Printing int: " << num << endl;
|
||||
std::cout << "Printing int: " << num << std::endl;
|
||||
}
|
||||
|
||||
void print(double num) {
|
||||
cout << "Printing double: " << num << endl;
|
||||
std::cout << "Printing double: " << num << std::endl;
|
||||
}
|
||||
|
||||
void print(char const *str) {
|
||||
cout << "Printing string: " << str << endl;
|
||||
std::cout << "Printing string: " << str << std::endl;
|
||||
}
|
||||
|
||||
int main() {
|
||||
@@ -43,4 +42,4 @@ Printing double: 3.14
|
||||
Printing string: Hello, world!
|
||||
```
|
||||
|
||||
Keep in mind that the number of parameters and their types should be different for two functions to be overloaded.
|
||||
Keep in mind that the number of parameters and their types should be different for two functions to be overloaded.
|
||||
Reference in new issue
Block a user