Skip to content

Commit bf0cb21

Browse files
committed
References and const correctness
1 parent 22100e0 commit bf0cb21

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

07_SimpleCppApp/main.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class FunctionPreCacher
5454
}
5555
}
5656

57-
void Print()
57+
void Print() const
5858
{
5959
if (values)
6060
{
@@ -70,6 +70,11 @@ class FunctionPreCacher
7070
int32_t(*function)(int32_t x) = nullptr;
7171
};
7272

73+
void PrintPc(const FunctionPreCacher& pc)
74+
{
75+
pc.Print();
76+
}
77+
7378
int main()
7479
{
7580
int32_t x;
@@ -81,5 +86,5 @@ int main()
8186

8287
FunctionPreCacher pc(x, count, &f);
8388
pc.Compute();
84-
pc.Print();
89+
PrintPc(pc);
8590
}

0 commit comments

Comments
 (0)