You are developing an application. The application includes classes named Mammal and Animal and an
interface named IAnimal. The Mammal class must meet the following requirements:
it must either inherit from the Animal class or implement the IAnimal interface.
it must be inheritable by other classes in the application.
You need to ensure that the Mammal class meets the requirements. Which two code segments can you use to
achieve this goal? (Each correct answer presents a complete solution. Choose two.)
A.
abstract class Mammal : IAnimal
{
…
}
B.
sealed class Mammal : IAnimal
{
…
}
C.
abstract class Mammal : Animal
{
…
}
D.
sealed class Mammal : Animal
{
…
}
Explanation:
sealed – When applied to a class, the sealed modifier prevents other classes from inheriting from it. http://
msdn.microsoft.com/en-us/library/88c54tsw(v=vs.110).aspx