New answers tagged

1

You are running up against the challenges inherent to an ORM. ORM's are by definition leaky abstractions. Martin Fowler has an excellent article addressing your "moral and computer-sciency issues". http://martinfowler.com/bliki/OrmHate.html The truth is, ORM's are a pain and never feel right, especially for purists. This is because quite simply they are not ...


3

If you're talking about variables of user-defined polymorphic types, then in C++ you need to use a pointer or a reference in order to achieve runtime polymorphism. The exact syntax you're describing is probably legal in C++ (hard to say since you didn't give a complete example), but results in "object slicing" rather than polymorphism. The reason is that a ...


1

If you need to be able to assign a subclass instance to a variable in c++, and you need reassignment, then what you want is a pointer. private: State* current_state; If there's ownership involved, you should use a smart pointer like unique_ptr or shared_ptr. shared_ptr most closely matches the semantics of Java references, other than the fact that it ...



Top 50 recent answers are included