24 lines
620 B
C++
24 lines
620 B
C++
|
/*
|
|||
|
* @Author: iR
|
|||
|
* @Date: 2022-03-12 13:36:15
|
|||
|
* @LastEditors: iR
|
|||
|
* @LastEditTime: 2022-03-12 13:37:15
|
|||
|
* @FilePath: \Code\1-1b\main.cpp
|
|||
|
* @Description:
|
|||
|
*
|
|||
|
* Copyright (c) 2022 by iR, All Rights Reserved.
|
|||
|
*/
|
|||
|
#include "../inc/matrix.hpp"
|
|||
|
#include <stdio.h>
|
|||
|
int main()
|
|||
|
{
|
|||
|
double data[] = {1, 2, 3, 4};
|
|||
|
Matrix<double> a(2, 2, data);
|
|||
|
std::cout << a.at(0, 0) << std::endl;
|
|||
|
a.at(0, 0) = 9;
|
|||
|
std::cout << a.at(0, 0) << std::endl;
|
|||
|
const Matrix<double> &ref_a = a; // 只读引用,因此ref_a只能调用以const结尾的成员函数
|
|||
|
std::cout << ref_a.at(0, 0) << std::endl;
|
|||
|
|
|||
|
return 0;
|
|||
|
}
|