umbrello 2.39.2 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

cxx11-object-construction-improvement.h
Go to the documentation of this file.
1// https://en.wikipedia.org/wiki/C%2B%2B11#Object_construction_improvement
2
3// #1
4 class SomeType {
5 int number;
6
7 public:
8 SomeType(int new_number) : number(new_number) {}
9 SomeType() : SomeType(42) {}
10};
11
12// #2
13 class BaseClass {
14 public:
15 BaseClass(int value);
16};
17
18 class DerivedClass : public BaseClass {
19 public:
20 using BaseClass::BaseClass;
21};
22
23// #3
24 class SomeClass {
25 public:
26 SomeClass() {}
27 explicit SomeClass(int new_value) : value(new_value) {}
28
29 private:
30 int value = 5;
31};
32
BaseClass
Definition cxx11-object-construction-improvement.h:13
BaseClass::BaseClass
BaseClass(int value)
DerivedClass
Definition cxx11-object-construction-improvement.h:18
SomeClass
Definition cxx11-object-construction-improvement.h:24
SomeClass::SomeClass
SomeClass(int new_value)
Definition cxx11-object-construction-improvement.h:27
SomeClass::SomeClass
SomeClass()
Definition cxx11-object-construction-improvement.h:26
SomeClass::value
int value
Definition cxx11-object-construction-improvement.h:30
SomeType
Definition cxx11-object-construction-improvement.h:4
SomeType::SomeType
SomeType(int new_number)
Definition cxx11-object-construction-improvement.h:8
SomeType::number
int number
Definition cxx11-object-construction-improvement.h:5
SomeType::SomeType
SomeType()
Definition cxx11-object-construction-improvement.h:9