salut a tout j'ais un probleme d'implementer les deux operator (operator+, operator*) et comment l'etuliser dans main()
#include <iostream>
#include<conio.h>
using namespace std;
class Matrice
{
int li,co;
int **mat;
public:
Matrice(const int&,const int&,const int&);
~Matrice(){};
int Getli(){return li;}
int Getco(){return co;}
void Setel(const int i,const int j ,const int el)
{
mat[i][j]=el;
}
int Getel(int i,int j )const{ return mat[i][j]; }
void LireMat();
void AffMat();
Matrice operator +(const Matrice&);
Matrice operator *(const Matrice&);
};
Matrice::Matrice(const int &n=3,const int &m=3,const int &init=0)
{
li=n; co=m;
mat = new int *[n];
int i,j;
for(i=0;i<li;i++)
mat[i]=new int[co];
for(i=0;i<li;i++)
for(j=0;j<co;j++)
mat[i][j]=init;
}
void Matrice::AffMat()
{
int i,j;
for(i=0;i<li;i++)
for(j=0;j<co;j++)
cout<<"Mat["<<i+1<<"]["<<j+1<<"] est "<<mat[i][j]<<endl;
}
void Matrice::LireMat()
{
int i,j,el;
mat =new int *[co];
for(i=0;i<co;i++)
mat[i]=new int[co];
for(i=0;i<co;i++)
for(j=0;j<li;j++)
{
cout<<"donner t["<<i+1<<"]["<<j+1<<"]"<<endl;
cin>>el;
mat[i][j]=el;
}
}
int main()
{
Matrice A;
A.LireMat();
A.AffMat();
getch();
return 0;
}