Using Class Template in Visual C++
<p>I wrote template which return matrix in Window Form Application .My template is below:</p>

<pre><code>   template&lt;class T&gt;
    class matrix1 {
    protected:  

    public:
          T *data;

            const unsigned rows, cols, size;
         matrix1(unsigned r, unsigned c) : rows(r), cols(c), size(r*c) {

          data = new T[size];
            }
            ~matrix1() { delete data; }
            void setValue(unsigned row, unsigned col, T value) { 
                    data[(row*cols)+col] = value;
            }
            T getValue(unsigned row, unsigned col) const {
                    return data[(row*cols)+col];
            }
</code></pre>

<p>I wrote this code in Main Project File in Windows Form Application.I defined 341*680 matrix with using this template :</p>

<pre><code>matrix1&lt;double&gt;A(341,680);
</code></pre>

<p>I used function that do operation on this template and I defined it like this:</p>

<pre><code>void function(matrix1&lt;double&gt; &amp;b,array&lt; double&gt;^ data)
</code></pre>

<p>And call it:</p>

<pre><code>function(A,data);
</code></pre>

<p>(data is one dimensinonal data array that I have to use for my programming algorithm)</p>

<p>For Example;When I want to print  data that is located in the first row and first column.</p>

<p>Visual C++ recognise <strong>getvalue</strong>  and <code>setvalue </code> function ,but couldn't print anything and gave a lot of error interested with <strong>matrix1</strong> template</p>

<p>I tried this template and function on <strong>CLR Console Application</strong> and it worked.How could I do this On Windows Form Application.And Where should I locate template class on Windows Form Application.</p>

<p>Best Regards...</p>
