Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
employee.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4#ifndef EMPLOYEE_H
5#define EMPLOYEE_H
6
8#include <QSharedData>
9#include <QString>
10
12{
13 public:
14 EmployeeData() : id(-1) { }
18
19 int id;
21};
22
23class Employee
24{
25 public:
27 Employee() { d = new EmployeeData; }
29 Employee(int id, const QString &name) {
30 d = new EmployeeData;
31 setId(id);
33 }
36 : d (other.d)
37 {
38 }
41 void setId(int id) { d->id = id; }
43 void setName(const QString &name) { d->name = name; }
45
47 int id() const { return d->id; }
49 QString name() const { return d->name; }
51
52 private:
53 QSharedDataPointer<EmployeeData> d;
54};
56
57#endif
QString name
Definition employee.h:20
EmployeeData(const EmployeeData &other)
Definition employee.h:15
Employee()
[1]
Definition employee.h:27
QString name() const
[5] //! [6]
Definition employee.h:49
Employee(int id, const QString &name)
[1] //! [2]
Definition employee.h:29
Employee(const Employee &other)
[2] //! [7]
Definition employee.h:35
int id() const
[4]
Definition employee.h:47
void setName(const QString &name)
[3] //! [4]
Definition employee.h:43
void setId(int id)
Definition employee.h:41
\inmodule QtCore
Definition qshareddata.h:19
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
GLenum GLuint id
[7]
GLuint name
QSharedPointer< T > other(t)
[5]