help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: what is wrong with this destruction function?


From: Ulrich Eckhardt
Subject: Re: what is wrong with this destruction function?
Date: Sat, 26 Feb 2005 18:03:43 +0100
User-agent: KNode/0.8.1

jack wrote:
> #include <iostream.h>
> #include <fstream.h>
> #include <vector.h>

Wrong, please read and head the warnings g++ gives.

> template<typename Elemtype>
> class Matrix{
> public:
>   Matrix(int row,int column);
>   Matrix(Matrix &);
>   ~Matrix();

The assignment operator is missing, the compiler-generated one is not
suitable for your class. Maybe that is also the reason of your problem,
because later you do this:

> Matrix<double> t3(4,4);
>  cout << t3;
>  t3= t+t2;

..which definitely leads to problems.

In general, there are quite a few other mistakes in your program that have
nothing to do with GCC, rather take those to alt.comp.lang.learn.c-c++.
Also, you violated one general rule, you didn't post a minimal example of
code that shows the error.

Uli

-- 
http://gcc.gnu.org/faq.html
http://parashift.com/c++-faq-lite/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]