GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Concepts  >  OOPS

 Print  |  
Question:  what is the use of procedure overriding

Answer: when do we use that procedure overriding


December 12, 2007 09:21:33 #1
 Sukrath   Member Since: December 2007    Total Comments: 2 

RE: what is the use of procedure overriding
 
To  supress the base class virtual method and wanted derived method to be called then Base class virtual method is overrided in the derived class.

class A

{

public virtual void func1()

{

Console.Write("Base function1");

}

}

class B : A

{

public override void func1()

{

Console.Write("Base function2");

}

}

static void Main(string[] args)

{

A a = new B();

a.func1();

}

     

 

Back To Question