Skip to content

Commit 3083932

Browse files
committed
test07.cpp
1 parent 7dc7782 commit 3083932

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

section2/test07.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,48 @@ void case1()
2020

2121
}
2222

23+
void case2()
24+
{
25+
using namespace std;
26+
27+
int x = 100;
28+
29+
const int& rx = x;
30+
const int* px = &x;
31+
32+
cout << rx << *px << endl;
33+
34+
string name = "uncharted";
35+
36+
const string* ps1 = &name;
37+
//*ps1 = "spiderman";
38+
39+
cout << *ps1 << endl;
40+
41+
string* const ps2 = &name;
42+
*ps2 = "spiderman";
43+
44+
cout << *ps2 << endl;
45+
46+
const string* const ps3 = &name;
47+
}
48+
49+
class DemoClass final
50+
{
51+
private:
52+
using mutex_type = int; // dummy type
53+
private:
54+
mutex_type m_mutex;
55+
56+
const long MAX_SIZE = 256;
57+
int m_value;
58+
public:
59+
int get_value() const
60+
{
61+
return m_value;
62+
}
63+
};
64+
2365

2466
constexpr
2567
int fib(int n)
@@ -36,6 +78,7 @@ int main()
3678
using namespace std;
3779

3880
case1();
81+
case2();
3982

4083
constexpr
4184
int fib5 = fib(5);

0 commit comments

Comments
 (0)