Newsgroup: comp.lang.c++
Subject: Exceptions in class
From: mymailaddressin@...
Date: Mon, 18 Nov 2013 10:33:43 -0800 (PST)
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::ostream& operator << ( std::ostream &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
Subject: Exceptions in class
From: mymailaddressin@...
Date: Mon, 18 Nov 2013 10:33:43 -0800 (PST)
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::ostream& operator << ( std::ostream &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
via Usenet Forums - Usenet Search,Free Usenet - comp.lang.c++ http://www.pocketbinaries.com/usenet-forums/showthread.php?131067-Exceptions-in-class&goto=newpost
View all the progranning help forums at:
http://www.pocketbinaries.com/usenet-forums/forumdisplay.php?128-Coding-forums
No comments:
Post a Comment