class is forward referenced when looking for 'v'
David Monagle via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jan 29 19:06:38 PST 2015
It's a bit hard to know where to start here. It's not obvious
from your code what you are trying to achieve.
In essence, you do have a circular reference as Base has
functions that use a types A and B which are derived from the
Base. I don't see how the complier could be asked to resolve this.
You are using a curious mix of tempting and inheritance, but
depending one what you are trying to achieve, you may only need
one or the other.
If you want classes other than A to recognise the value "v", then
you should define a "v" property either in the Base class, a
class derived from it or in an interface. This will allow you to
use the correct overloading (or "static if" in templating) to
catch the scenario of it being passed into the Foo function.
As I say. This is not a great real world example so it's hard to
answer without a better explanation of what you are trying to do.
It is not, however a bug in the compiler.
Just another note. "public" is redundant for a class.
More information about the Digitalmars-d-learn
mailing list