Gobelijn API documentation  - generated for commit a0cbea7
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
exampleConst.cpp
Go to the documentation of this file.
1 
9 #include <iostream>
10 
11 class A
12 {
13 public:
14  explicit A(int i) : m_i(i){};
15 
16  void f() const { std::cout << "Using f() const: value i = " << m_i << std::endl; }
17 
18  void f() { std::cout << "Using f(): value i = " << ++m_i << std::endl; }
19 
20 private:
21  int m_i = 0;
22 };
23 
24 int main()
25 {
26  A a(1);
27  a.f();
28 
29  const A b(1);
30  b.f();
31  return 0;
32 }
int main()