On 12/22/2014 1:11 AM, Derix wrote:
Yep, I rekon the difference was not clear to me. It still isn't
right now, but at least now I know that it exists and I have to
look into it.
Overriding - a subclass reimplements a method from a base class. The
method must have the same number and type of p
Thanks a lot, I begin to see the light !
you aren't overriding anything -- you are
/overloading/
Yep, I rekon the difference was not clear to me. It still isn't
right now, but at least now I know that it exists and I have to
look into it.
As to the spell you cast to my cats in your rewriting
On Sunday, 21 December 2014 at 15:05:47 UTC, Mike Parker wrote:
// Now do Catty things
pickiness = (mother.pickiness + father.pickiness) / 2;
Sorry, forgot to change that line when I copy-pasted. Should be:
pickiness = (catmom.pickiness + catdad.pickiness) / 2;
On Sunday, 21 December 2014 at 10:42:37 UTC, Derix wrote:
If you change the mother and father parameters from Beasts to
Cats, then you aren't overriding anything -- you are
/overloading/. That's where the first two errors were coming
from. In order for a subclass method to override a base cl
Thank you kindly for this detailed response. Your directions bore
frution, and I now have cats that breed cats (and not dogs).
However I can't get rid of the following warning on compilation :
|...
| void mixGenetics(Cat mother,Cat father) {...}
|...
Warning: Beast.Beast.mixGenetics(Beast mother
On Saturday, 20 December 2014 at 15:40:32 UTC, Derix wrote:
// do what all beasts do
You'll want to call the function in the base class, which is done
with the super keyword in D.
I wouldn't make the super function return the new instance
though, that can't be as easily cust
On Saturday, 20 December 2014 at 15:40:32 UTC, Derix wrote:
So, I have this pet project where classes Cat and Dog inherit
from the more generic Beast class.
All beasts prosper and multiply and so do cats and dogs. The
breeding routine is fairly constant across species, with minor
variations. So
So, I have this pet project where classes Cat and Dog inherit
from the more generic Beast class.
All beasts prosper and multiply and so do cats and dogs. The
breeding routine is fairly constant across species, with minor
variations. So I'd like to define the "breed" method in the Beast
class and