JustCpp
Repo wih C++ stuff
Loading...
Searching...
No Matches
oop.hpp
Go to the documentation of this file.
1#ifndef OOP_HPP
2#define OOP_HPP
3
4#include <memory>
5#include <utility>
6#include <iostream>
7
8void friend_function(void);
9
11 /* Can be accessed from anywhere in the program */
12 public:
14 float public2;
15 void public_method1(void);
16
17 /* Can be accessed only by the member functions or friend class/function*/
18 private:
20 float private2;
21 void private_method1(void);
22
24 friend void friend_function(void);
25
26 /* Similar to private, but can be accessed by any sub-class */
27 protected:
30 void protected_method1(void);
31
32};
33
35 public:
36 void public_method1(void);
37};
38
40 public:
41 void public_method1(void);
42};
43
45 public:
46 void public_method1(void);
47};
48
50 public:
51 void public_method1(void);
52};
53
55 void example(void);
56}
57
58
60 public:
61 /* This pure virtual method makes an abstract class */
62 virtual int publicMethod1(int a) = 0;
63
64 private:
65 virtual int privateMethod1(int a) = 0;
66};
67
69 public:
70 int publicMethod1(int a) override;
71
72 private:
73 int privateMethod1(int a) override;
74};
75
77 public:
78 /* There's no method to override due int vs float declaration */
79 //int publicMethod1(float a) override;
80};
81
83 int example(int a);
84}
85
87 public:
89 virtual int method(int a) = 0;
90};
91
93 public:
94 int method(int a) override;
95};
96
98 int example(int a);
99}
100
102 private:
104
105 public:
107 private1 = 0;
108 }
109
111
112 int testClass(void) {
113 return private1;
114 }
115};
116
118 private:
120
121 public:
122 MoveConstructor(int a);
125
126 int getData(void);
127};
128
130 private:
132
133 public:
134 CopyConstructor(int a);
136
137 int getData(void);
138};
139
146
147 std::pair<int, int> example(ConstructorType type, int value);
148}
149
150
152 private:
153 static inline int integer = 16;
154
155 public:
156 int getValue(void);
157 void changeValue(int value);
158};
159
161 int example(int value);
162}
163
164namespace OpOverload {
165 struct Complex {
166 double real;
167 double imaginary;
168 };
169
170 Complex example(void);
171 Complex operator+(const Complex& a, const Complex& b);
172 std::ostream& operator<< (std::ostream& stream, const Complex& a);
173}
174
175namespace Templates {
176 template<typename T> T myMax(T a, T b);
177 template<typename T> T variable_template = T(16.161616);
178 void example(void);
179}
180
181#endif
Definition oop.hpp:92
int method(int a) override
Definition oop.cpp:80
Definition oop.hpp:86
virtual ~AbstractionInterface()
Definition oop.hpp:88
virtual int method(int a)=0
Definition oop.hpp:34
void public_method1(void)
Definition oop.cpp:45
Definition oop.hpp:39
void public_method1(void)
Definition oop.cpp:58
Definition oop.hpp:10
friend class AllAccessModifiers_friend
Definition oop.hpp:23
float public2
Definition oop.hpp:14
void private_method1(void)
Definition oop.cpp:11
int private1
Definition oop.hpp:19
float private2
Definition oop.hpp:20
int public1
Definition oop.hpp:13
friend void friend_function(void)
Definition oop.cpp:3
void public_method1(void)
Definition oop.cpp:10
float protected2
Definition oop.hpp:29
int protected1
Definition oop.hpp:28
void protected_method1(void)
Definition oop.cpp:12
CopyConstructor(int a)
Definition oop.cpp:111
int private1
Definition oop.hpp:131
int getData(void)
Definition oop.cpp:119
DefaultContructor(void)
Definition oop.hpp:106
int testClass(void)
Definition oop.hpp:112
int private1
Definition oop.hpp:103
DefaultContructor(int a)
Definition oop.hpp:110
~MoveConstructor()
Definition oop.cpp:99
int getData(void)
Definition oop.cpp:104
int * private1
Definition oop.hpp:119
MoveConstructor(int a)
Definition oop.cpp:90
Definition oop.hpp:59
virtual int publicMethod1(int a)=0
virtual int privateMethod1(int a)=0
Definition oop.hpp:68
int privateMethod1(int a) override
Definition oop.cpp:69
int publicMethod1(int a) override
Definition oop.cpp:65
Definition oop.hpp:76
Definition oop.hpp:151
static int integer
Definition oop.hpp:153
void changeValue(int value)
Definition oop.cpp:161
int getValue(void)
Definition oop.cpp:157
Definition oop.hpp:97
int example(int a)
Definition oop.cpp:84
Definition oop.hpp:54
void example(void)
Definition oop.cpp:14
Definition oop.hpp:140
std::pair< int, int > example(ConstructorType type, int value)
Definition oop.cpp:123
ConstructorType
Definition oop.hpp:141
@ c_default
Definition oop.hpp:142
@ c_move
Definition oop.hpp:143
@ c_copy
Definition oop.hpp:144
Definition oop.hpp:164
Complex operator+(const Complex &a, const Complex &b)
Definition oop.cpp:173
Complex example(void)
Definition oop.cpp:182
std::ostream & operator<<(std::ostream &stream, const Complex &a)
Definition oop.cpp:189
Definition oop.hpp:82
int example(int a)
Definition oop.cpp:73
Definition oop.hpp:160
int example(int value)
Definition oop.cpp:165
Definition oop.hpp:175
T myMax(T a, T b)
Definition oop.cpp:194
T variable_template
Definition oop.hpp:177
void example(void)
Definition oop.cpp:198
void friend_function(void)
Definition oop.cpp:3
Definition oop.hpp:165
double real
Definition oop.hpp:166
double imaginary
Definition oop.hpp:167