Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 11 / Examples / Bar / Pair
diff options
context:
space:
mode:
1 files changed, 43 insertions, 0 deletions
-rw-r--r--Sem. 11/Examples/Bar/Pair/Pair.hpp43
diff --git a/Sem. 11/Examples/Bar/Pair/Pair.hpp b/Sem. 11/Examples/Bar/Pair/Pair.hpp
new file mode 100644
index 0000000..5f83d0c
--- /dev/null
+++ b/Sem. 11/Examples/Bar/Pair/Pair.hpp
@@ -0,0 +1,43 @@
+#pragma once
+
+template<typename T, typename D>
+class Pair
+{
+ T first;
+ mutable D second; // For Drinks task!!
+public:
+ Pair() = default;
+ Pair(const T& first, const D& second);
+ const T& getFirst() const;
+ const D& getSecond() const;
+
+ void setFirst(const T& newValue);
+ void setSecond(const D& newValue) const ;
+};
+
+template<typename T, typename D>
+Pair<T,D>::Pair(const T& first, const D& second) : first(first), second(second)
+{}
+
+template<typename T, typename D>
+const T& Pair<T, D>::getFirst() const
+{
+ return first;
+}
+template<typename T, typename D>
+const D& Pair<T, D>::getSecond() const
+{
+ return second;
+}
+
+template<typename T, typename D>
+void Pair<T, D>::setFirst(const T& newValue)
+{
+ first = newValue;
+}
+
+template<typename T, typename D>
+void Pair<T, D>::setSecond(const D& newValue) const
+{
+ second = newValue;
+} \ No newline at end of file