C++ Class Templates

  • + 0 comments
    template <class T>
    class AddElements {
    private:
        T element;
    public:
        AddElements(const T& element) : element(element) {}
    
        T add(const T& other) {
            return element + other;
        }
    
        T concatenate(const T& other) {
            return element + other;
        }
    };