M
mymailaddressin
im trying to handling exception in my matriz class. I have no idea how this suppoosed to be
My matriz class its like this
#ifndef Matriz_H
#define Matriz_H
#include <iostream>
#include <iomanip>
using namespace std;
template <typename T> class Matriz ;
template <typename T> std::istream& operator >> ( std::istream &is_in,Matriz <T> &M);
template <typename T> std:stream& operator << ( std:stream &os_out, const Matriz <T> &M);
template <typename T>
class Matriz{
friend ostream &operator << <> (ostream &, const Matriz <T> &);
friend istream &operator >> <> (istream &, Matriz <T> &);
public:
Matriz (int = 5, int = 5);
Matriz (const Matriz &);
~Matriz ();
void setSize (int = 5, int = 5);
const Matriz &operator = (const Matriz &);
bool operator == (const Matriz &) const;
Matriz operator * (const Matriz &);
T &operator () (int, int);
private:
int nrows;
int ncols;
T **pntr;
};
#endif
im trying to make the out of range exception in
template <typename T> T &Matriz <T> :: operator()(int rws, int clm) {
// try{
return pntr[rws][clm];
// }
// catch{
// cout << "Out Of Range" << endl;
// }
}
also i would like to know how to handle the invalid type exception
Thanks in advance
My matriz class its like this
#ifndef Matriz_H
#define Matriz_H
#include <iostream>
#include <iomanip>
using namespace std;
template <typename T> class Matriz ;
template <typename T> std::istream& operator >> ( std::istream &is_in,Matriz <T> &M);
template <typename T> std:stream& operator << ( std:stream &os_out, const Matriz <T> &M);
template <typename T>
class Matriz{
friend ostream &operator << <> (ostream &, const Matriz <T> &);
friend istream &operator >> <> (istream &, Matriz <T> &);
public:
Matriz (int = 5, int = 5);
Matriz (const Matriz &);
~Matriz ();
void setSize (int = 5, int = 5);
const Matriz &operator = (const Matriz &);
bool operator == (const Matriz &) const;
Matriz operator * (const Matriz &);
T &operator () (int, int);
private:
int nrows;
int ncols;
T **pntr;
};
#endif
im trying to make the out of range exception in
template <typename T> T &Matriz <T> :: operator()(int rws, int clm) {
// try{
return pntr[rws][clm];
// }
// catch{
// cout << "Out Of Range" << endl;
// }
}
also i would like to know how to handle the invalid type exception
Thanks in advance