1
0
Fork 0

Ex4.2 feedback: CaloGrid::cell() return pointer instead of object

This commit is contained in:
Eric Teunis de Boone 2020-06-30 14:00:21 +02:00
parent 83bf4e34dc
commit 52d1f4e4e9
2 changed files with 4 additions and 1 deletions

View file

@ -13,6 +13,6 @@ CaloCell* CaloGrid::cell(int x, int y ) {
return nullptr; return nullptr;
} }
return cells[ x * nx + y ] ; return &cells[ x*nx + y ] ;
} }

View file

@ -25,6 +25,9 @@ class CaloGrid
} }
CaloCell* cell(int x, int y); CaloCell* cell(int x, int y);
const CaloCell* cell(int x, int y) const {
return const_cast<CaloCell*> (cell(x, y));
}
private: private: