The short answer and bad news is that if you can only return a single value from a function. The good news is that you can return anything that's a value, which is just about anything. So you could write something like...
return std::make_pair( class_1::X(), class_2::X() );
and get what you asked for, even though you don't actually want to do that. Why not? Read on...
Public inheritance only really makes sense where objects of the derived class can be substituted for all places you use instances of the base class. So this means everywhere you write something like:
void frob( base_class &b );
int main()
{
base_class b;
frob( b );
}
you can instead write:
int main()
{
derived_class d;
frob( d );
}
and the
program is still valid. The program doesn't have to have the same behaviour (there'd be no point to inheritance otherwise) but it must still compile and run without error. It's one of the cornerstones of OO design.
In your case you're saying "wherever I use a base_class_1 OR a base_class_2 in my code I want to be able to substitute a derived_class object and the program still remain valid but I want the return types of several of my functions to return something different and all the client code still be valid." That's a big ask so I'd advise looking at your code and seeing if it's really the best idea (HINT: It's not).
The problem sounds like you've got two concepts that are similar and presumably share a fair chunk of code. No idea what the concepts are from you code or description but they seem to be things that rely on a coordinate system. Instead of messing about with multiple inheritance what I'd suggest you look for an abstraction for the coordinate system and the way it represents and manipulates points and parameterise that in what is now your derived class, e.g. something like:
template<class coordinate_system>
class graphical_vector
{
public:
graphical_vector( coordinate_system::point_type &start, coordinate_system::point_type &end ): start_(start), end_(end){};
double length() const
{
return distance_from( start_, end_ );
};
private:
const coordinate_system::point_type start_;
const coordinate_system::point_type end_;
};
As I have no idea of what sort of app you're writing I have no idea if this stands any chance of success. Fairly often when I've seen multiple inheritance being used in the way you advocate this sort of solution works better.
If this is complete balls please feel free to clarify your question a bit (actually a lot) by telling us what you're trying to achieve and why. It may turn out you've got a really cool, valid use case that'll tell the rest of us something and improve what we do or we might be able to suggest other ways for you to go that are better for you and your code in the long run.