geekbrains_oop_cpp/lesson_5/exercise_2.hpp

30 lines
481 B
C++

#ifndef EXERCISE_2_HPP_
#define EXERCISE_2_HPP_
template <typename T1, typename T2>
class Pair
{
private:
T1 m_first;
T2 m_second;
public:
Pair(const T1& first, const T2& second) : m_first(first), m_second(second) { }
const T1& first() const;
const T2& second() const;
};
template <typename T1, typename T2>
const T1& Pair<T1, T2>::first() const
{
return m_first;
}
template <typename T1, typename T2>
const T2& Pair<T1, T2>::second() const
{
return m_second;
}
#endif