summaryrefslogtreecommitdiff
path: root/tests/projects/c++/modules/headerunits_person/src
diff options
context:
space:
mode:
authorruki <[email protected]>2022-08-24 22:45:24 +0800
committerruki <[email protected]>2022-08-24 22:45:24 +0800
commitee55b56ef385023a290e495f6626ab7aeea2c5b8 (patch)
tree913bef27565fe91265b32b526b08877588287a42 /tests/projects/c++/modules/headerunits_person/src
parente94c67aea65b7b64246a79b7f125c11f3268371d (diff)
improve module deps
Diffstat (limited to 'tests/projects/c++/modules/headerunits_person/src')
-rw-r--r--tests/projects/c++/modules/headerunits_person/src/Person.mpp20
-rw-r--r--tests/projects/c++/modules/headerunits_person/src/test.cpp11
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/headerunits_person/src/Person.mpp b/tests/projects/c++/modules/headerunits_person/src/Person.mpp
new file mode 100644
index 000000000..e2dbf4044
--- /dev/null
+++ b/tests/projects/c++/modules/headerunits_person/src/Person.mpp
@@ -0,0 +1,20 @@
+module;
+
+#include <cstddef> //
+
+export module person;
+
+import <string>;
+
+export class Person {
+public:
+ Person(std::string firstName, std::string lastName)
+ : m_firstName{std::move(firstName)}, m_lastName{std::move(lastName)} {}
+
+ const std::string &getFirstName() const { return m_firstName; }
+ const std::string &getLastName() const { return m_lastName; }
+
+private:
+ std::string m_firstName;
+ std::string m_lastName;
+};
diff --git a/tests/projects/c++/modules/headerunits_person/src/test.cpp b/tests/projects/c++/modules/headerunits_person/src/test.cpp
new file mode 100644
index 000000000..7c01dc782
--- /dev/null
+++ b/tests/projects/c++/modules/headerunits_person/src/test.cpp
@@ -0,0 +1,11 @@
+import person;
+import <iostream>;
+import <string>; // For operator<< for std::string
+
+using namespace std;
+
+int main()
+{
+ Person person{ "Kole", "Webb" };
+ cout << person.getLastName() << ", " << person.getFirstName() << endl;
+}