What is the use of the override keyword?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is the use of the override keyword?
Rating:
The override keyword is used to override the method declared in the base class after inheriting it from the sub class. The method overridden by an override declaration is known as the overridden base method. The method overridden in the sub class must have the same signature as the base class method. A nonvirtual or static method cannot be overridden. The following code snippet displays the use of the override keyword:
public class base
{
public void virtual show()
{
Console.Write("Base Class");
}
}
public class sub
{
public void override show()
{
Console.Write("Sub Class");
}
}
Rating:
Was this information helpful?
Other articles
- Windows Controls
- What is the Public Key Encryption?
- What is a nullable type?
- What is Boxing?
- How to retrieve information about the paused services?