Hi,
What is the difference between world.hpp and worldimp.hpp? It seems that everything in world.hpp is defined in worldimp.cpp, and all in worldimp.hpp is also defined in worldimp.cpp
How are these classes related? Why are they separate?
Thank you,
Difference between world and worldimp?
Re: Difference between world and worldimp?
world.hpp is the interface for the MWWorld subsystem that other subsystem's can use. worldimp.hpp declares the implementation of the MWWorld subsystem, which can contain internal details that other subsystems don't need to know about (keeping interface and implementation separate is good for ensuring private data stays private, and doesn't require recompiling everything that uses the interface because a new non-interface thing was modified). And worldimp.cpp defines the functions and such that actually run. Almost all the subsystems follow this pattern.
Re: Difference between world and worldimp?
Thanks Chris,
So, to make sure I understand. world.hpp declares the public functions of the MWWorld subsystem, worldimp.hpp declares the private, and all MWWorld functions public or private are defined in worldimp.cpp?
So, to make sure I understand. world.hpp declares the public functions of the MWWorld subsystem, worldimp.hpp declares the private, and all MWWorld functions public or private are defined in worldimp.cpp?
Re: Difference between world and worldimp?
Basically, yeah. Though the "public functions" in world.hpp are what's known as "pure virtual" interface. They're virtual methods that belong to a class that has no explicit implementation. Instead, worldimp.hpp derives from the interface, overriding the virtual methods with ones that get implemented. That's one of two common ways to separate interface from implementation in C++.