A
A
alexandCmyk2016-12-20 17:14:21
C++ / C#
alexandCmyk, 2016-12-20 17:14:21

How to pass an instance of a class template to a function?

I have a class template:

template<typename T>class Multiplicity
{
private:
  vector<T> Field;
public:
  Multiplicity();
  ~Multiplicity();
  void show() const;
  int getLength() const;
  void insert(T Elem);
  void deleteElem(T elem);
  void sortArray();
  bool empty() const;
  bool have(T elem) const;
};

I create an instance of it
Multiplicity<int> ArrayInt;
Now I need to pass the created ArrayInt instance to my function which is called function1, how to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maaGames, 2016-12-20
@alexandCmyk

void function1( Multiplicity & name );
Those. though a template, though not a template - the syntax differs only in setting the type, everything else is the same as for any other function without templates.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question