#ifndef MATRIX_H
#define MATRIX_H
#include <iostream>
using namespace std;
template <typename E>
class Matrix
{
public:
int rows,cols,length;
Matrix(int _m,int _n);
Matrix(const Matrix<E> &M) ;
~Matrix();
Matrix<E> & operator+(Matrix<E> &M);
Matrix<E> & operator-(Matrix<E> &M);
Matrix<E> & operator=(const Matrix<E> &M);
Matrix<E> & T();
E& operator()(int i,int j)
{
if ( (i>=0 && i<rows) &&(j>=0 && j<cols ) ){
C++ -- 实现矩阵类
最新推荐文章于 2023-09-23 21:27:30 发布
本文详细探讨了如何在C++中设计和实现一个矩阵类,涵盖了矩阵的基本操作,如初始化、加法、减法和乘法。通过实例代码展示了矩阵类的成员函数和友元函数的使用,深入理解C++面向对象编程的应用。
摘要由CSDN通过智能技术生成