how is this considered hiding methods?
Gor Gyolchanyan
gor.f.gyolchanyan at gmail.com
Sat Sep 22 00:49:04 PDT 2012
Can someone please tell me why the following code gives these
errors?
Error: class main.BirdZoo use of main.VertebrateZoo.take(Animal
animal_) hidden by BirdZoo is deprecated
Error: class main.ParrotZoo use of main.VertebrateZoo.take(Animal
animal_) hidden by ParrotZoo is deprecated
/// The code:
class Animal { }
class Vertebrate { }
class Bird: Animal { }
class Parrot: Bird { }
class VertebrateZoo
{
void take(Animal animal_)
{
if(auto vertebrate = cast(Vertebrate)animal_)
take(vertebrate);
}
abstract void take(Vertebrate vertebrate_);
}
class BirdZoo: VertebrateZoo
{
override void take(Vertebrate vertebrate_)
{
if(auto bird = cast(Bird)vertebrate_)
take(bird);
}
abstract void take(Bird bird_);
}
class ParrotZoo: BirdZoo
{
override void take(Bird bird_)
{
if(auto parrot = cast(Parrot)bird_)
take(parrot);
}
abstract void take(Parrot parrot_);
}
More information about the Digitalmars-d-learn
mailing list