MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / IntMat

Class IntMat

week13/examples/matclass.cpp:5–24  ·  view source on GitHub ↗

Class IntMat

Source from the content-addressed store, hash-verified

3
4// Class IntMat
5class IntMat
6{
7 size_t rows;
8 size_t cols;
9 int * data;
10 public:
11 IntMat(size_t rows, size_t cols):
12 rows(rows), cols(cols)
13 {
14 data = new int[rows * cols]{};
15 }
16 ~IntMat()
17 {
18 delete [] data;
19 }
20 IntMat(const IntMat&) = delete;
21 IntMat& operator=(const IntMat&) = delete;
22 int getElement(size_t r, size_t c);
23 bool setElement(size_t r, size_t c, int value);
24};
25int IntMat::getElement(size_t r, size_t c)
26{
27 if ( r >= this->rows || c >= this->cols)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected