Method Overriding in C#

Method Overriding can be defined as: being able to change or augment the behavior of methods in classes, known as overriding their logic; it is one of the most powerful aspects of Object Oriented Programming.

Suppose you have a Phone, no please don’t suppose everyone has a phone today, although some people even have more than one. Okay leave it, so if you have phone

using System;
namespace OOPSConcepts
class BaseClass
public virtual void Ringing() {
Console.WriteLine(“Base Class”);

class DerivedClass : BaseClass
public override void Ringing()
Console.WriteLine(“Derived Class”);

static void Main(string[] args)
//Method Overidding
BaseClass bc = new DerivedClass();



Is it possible to override the virtual method without using inheritance?

Read more…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s