Hello! It seems to be a simple question, but I could not find the cause of the bug:
class World{ public: ... Block ***getTerrain(){ return &this->terrain; }; ... private: Block **terrain; } There is a class that has an array of objects. When accessing an array inside a class (like this->terrain[i][j].getType() ), everything is fine, but when I try to use the link returned by the getTerrain function ( this->world->getTerrain()[i][j]->getType() ), a segmentation error occurs. What is the problem?
By the way, when I refer to null elements ( this->world->getTerrain()[0][0]->getType() ), everything goes fine.