With a background in C++, I am currently trying to learn Python and am trying to understand how to write code without pointers. In a specific example, I would like to know how to implement the following C++ code in Python:
class Room: public MapSite
{
public:
Room(int roomNo);
MapSite* GetSide(Direction) const; // Direction is an enum
void SetSide(Direction, MapSite*);
virtual void Enter(); // An inherited method from MapSite class
private:
MapSite* sides(4);
int roomNo;
}
The above example comes from
Desgin Patterns: Elements of Reusable Object-Oriented Software
I want to know how you would implement the above in Python, specifically the GetSide() function and the sides variable that utilize a pointer to another class. Thank you.
Edit:
What I wanted to know originally, without fully realizing it at first, was how the C++ class I provided could be implemented in a Pythonic way. I now realize that is too broad of a request, though some of the answers were helpful to me and set me on the right path.