-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

can someone help me to solve thise problem:

Imagine I've got this class hierachy:

class A
{
  virtual bool foo( A bar ) = 0;
}

class B : A
{
  bool foo( B bar )
  {
    ...
  }
  ....
}

int main( void )
{
  B foobar;
}

this won't compile as my class B is still abstract as I didn't provide a
"bool foo( A bar )" member.

But I only want class A to be an interface that tells everybody what to
expect from it's derivated classes. And one of these things is, that
every child must have a member that is called "foo" and has one
parameter of the type of the child itself.

How do I achieve that?


The only workaround I can come up with is, that I have:
class B
{
  friend bool foo( class B, class B );
}

bool foo( class B bar1, class B bar2 )
{
 ...
}

I this doesn't guarantee me, that every child of A must have a foo
function...

Thanks,
Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB6STplhWtxOxWNFcRAk3mAJ0fkaueOVn9PF/pJmc3+vr8v5UXEACfZS10
c0NJMnATew8HrgigWxL+ayQ=
=VrIH
-----END PGP SIGNATURE-----

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to