Gobelijn API documentation
- generated for commit a0cbea7
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Friends
Macros
Pages
constness.cpp
Go to the documentation of this file.
1
13
#include <iostream>
14
15
using namespace
std;
16
17
class
Test
18
{
19
public
:
20
explicit
Test(
int
val) : i(val) {}
21
22
Test(
const
Test& that) =
default
;
23
24
// Test& operator=(const Test & that) {
25
// int * var = const_cast<int*>(&i);
26
// *var = that.i;
27
// return *this;
28
// }
29
30
int
getValue()
const
{
return
i; }
31
32
private
:
33
const
int
i;
// const data member verwijderd impliciete assignment operator
34
};
35
36
int
main
()
37
{
38
Test b(2);
39
cout <<
"b.i = "
<< b.getValue() <<
"\n"
;
40
41
// Test t(3);
42
// b = t; // !!!!!! assignment zonder custom assignment operator
43
// zal
44
// een compile error geven
45
46
cout <<
"b.i = "
<< b.getValue() <<
"\n"
;
47
return
0;
48
}
main
int main()
Definition:
constness.cpp:36
main
cpp
demo-const
constness.cpp
Generated on Fri Feb 1 2019 09:33:32 for Gobelijn API documentation by
1.8.6