MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / compare

Method compare

Exercises/NoModules/Chapter 12/Soln12_02/Integer.cpp:19–27  ·  view source on GitHub ↗

Compare function with reference parameter

Source from the content-addressed store, hash-verified

17
18// Compare function with reference parameter
19int Integer::compare(const Integer& obj) const
20{
21 if (m_value < obj.m_value)
22 return -1;
23 else if (m_value == obj.m_value)
24 return 0;
25 else
26 return 1;
27}
28
29void Integer::show() const
30{

Callers 1

mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected