File tree 2 files changed +15
-7
lines changed
2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1
1
/* *
2
2
* @file main.cpp
3
3
* @author Xuhua Huang
4
- * @brief
4
+ * @brief
5
5
* @version 0.1
6
6
* @date 2023-03-25
7
- *
7
+ *
8
8
* g++ .\main.cpp -o ./piml.exe -std=c++2a
9
9
* ./pimpl.exe
10
- *
10
+ *
11
11
* @copyright ueg (c) 2023
12
- *
12
+ *
13
13
*/
14
14
15
15
#include " person.hpp"
16
16
17
- int main () {
17
+ int main ()
18
+ {
18
19
pimpl::Person p (" Alice" , 30 );
19
- std::cout << p.name () << " , " << p.age () << std::endl ;
20
+ std::cout << p.name () << " , " << p.age () << " \n " ;
20
21
21
22
p.setName (" Bob" );
22
23
p.setAge (40 );
23
- std::cout << p.name () << " , " << p.age () << std::endl ;
24
+ std::cout << p.name () << " , " << p.age () << " \n " ;
24
25
25
26
return 0 ;
26
27
}
Original file line number Diff line number Diff line change @@ -28,6 +28,13 @@ class Person
28
28
std::string name () const ;
29
29
void setName (const std::string& name);
30
30
31
+ /* *
32
+ * @brief Set the Name object
33
+ * The setName function is a member of the pimpl::Person class and takes an rvalue reference to a std::string as its
34
+ * parameter, allowing the caller to set the name of the Person object by moving the string.
35
+ */
36
+ void setName (std::string&&);
37
+
31
38
int age () const ;
32
39
void setAge (int age);
33
40
You can’t perform that action at this time.
0 commit comments