Student with set
student.h
Go to the documentation of this file.
1 #pragma once
2 #include <iostream> // ostream
3 #include <string>
4 #include <set>
5 #include <vector>
6 //using namespace std;
7 
10 class Student
11 {
12 public:
14  Student();
15 
22  Student(const std::string& name, const std::string& matrikel, const int studium);
23 
30  Student(const std::string & name, const std::string& matnr, const std::vector<int>& skz);
31 
32  // automatic generation of copy constructor and assignment operator by the compiler
33  // in C++11: the Assignment operator (and any other method) can be explicitely deleted via:
34  Student(const Student &orig) = default;
35  Student( Student &&orig) = default;
36  // const member '_matr_nr' ==> kein Zuweisungsoperator moeglich!
37  Student& operator=(const Student &rhs) = delete;
38  Student& operator=( Student &&rhs) = delete;
39 
40 
42  //virtual
43  ~Student() { }
44 
48  std::string Getname() const
49  {
50  return _name;
51  }
52 
56  void Setname(const std::string &val) { _name = val; }
57 
62  std::string Getmatr_nr() const
63  {
64  return _matr_nr;
65  }
66 
72  void Add_SKZ(const int skz);
73 
78  void Del_SKZ(const int skz);
79 
84  int num_Studies() const
85  {
86  return static_cast<int>(_skz.size());
87  }
88 
93  std::vector<int> Get_SKZ() const;
94 
99  friend std::ostream& operator<<(std::ostream& s, const Student& rhs);
100 
106  friend std::istream& operator>>(std::istream& s, Student& rhs);
107 protected:
108 
109 private:
110  std::string _name;
111  // const member ==> kein Zuweisungsoperator moeglich!
112  const std::string _matr_nr;
113  std::set<int> _skz;
114 };
std::vector< int > Get_SKZ() const
Definition: student.cpp:42
Student & operator=(Student &&rhs)=delete
~Student()
Definition: student.h:43
void Del_SKZ(const int skz)
Definition: student.cpp:37
Student & operator=(const Student &rhs)=delete
Student(Student &&orig)=default
Student(const std::string &name, const std::string &matrikel, const int studium)
friend std::ostream & operator<<(std::ostream &s, const Student &rhs)
Student(const Student &orig)=default
std::string Getname() const
Definition: student.h:48
Student(const std::string &name, const std::string &matnr, const std::vector< int > &skz)
int num_Studies() const
Definition: student.h:84
void Setname(const std::string &val)
Definition: student.h:56
std::string Getmatr_nr() const
Definition: student.h:62
void Add_SKZ(const int skz)
Definition: student.cpp:32
Student()
Definition: student.cpp:8
friend std::istream & operator>>(std::istream &s, Student &rhs)