ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
 
Categories  >>  Software  >>  Microsoft Related  >>  C Sharp
 
 


 

 
 Visual Basic interview questions  Visual Basic Interview Questions
 C Sharp interview questions  C Sharp Interview Questions
 ASP.NET interview questions  ASP.NET Interview Questions
 VB.NET interview questions  VB.NET Interview Questions
 COM+ interview questions  COM+ Interview Questions
 ADO.NET interview questions  ADO.NET Interview Questions
 IIS interview questions  IIS Interview Questions
 MTS interview questions  MTS Interview Questions
 Crystal Reports interview questions  Crystal Reports Interview Questions
 BizTalk interview questions  BizTalk Interview Questions
 Dot Net interview questions  Dot Net Interview Questions
 Exchange Server interview questions  Exchange Server Interview Questions
 SharePoint interview questions  SharePoint Interview Questions
 Microsoft Related AllOther interview questions  Microsoft Related AllOther Interview Questions
Question
If I want to override a method 1 of class A and in class b
then how do you declare ?
 Question Submitted By :: Deepa
I also faced this Question!!     Rank Answer Posted By  
 
  Re: If I want to override a method 1 of class A and in class b then how do you declare ?
Answer
# 1
declare method1 as virtual in classA and then create classB 
as derived class of ClassA and override method1 in classB.

class ClassA{
 public virtual add();  

}

class ClassB:ClassA{
public overrride add(){

console.WriteLine("Im in derived");

}

}
 
Is This Answer Correct ?    5 Yes 0 No
Sridevi
 
  Re: If I want to override a method 1 of class A and in class b then how do you declare ?
Answer
# 2
If using VB.NET as the code behind, you use must override 
instead of virtual and overrides in the derived classs

public class parent

public mustoverride sub walk()
messagebox.show("Parent")
end sub
end class

public class child
inherits parend

public overrides sub walk()
messagebox.show("Child")
end sub

end class
 
Is This Answer Correct ?    0 Yes 1 No
Avaneesh Bajoria
 
 
 

 
 
 
Other C Sharp Interview Questions
 
  Question Asked @ Answers
 
what are the advantages of c# over vb.net? Choice-Solutions6
Can you declare the override method static while the original method is non-static?  2
What is a delegate?  4
how to store the value in textbox using delegates if we have two user control. the value will be called from one user control to another user control. Loading and unloading will be done through delegates.  1
what is namespace?  6
How many catch blocks can be there for a single try block? HCL2
What are the types of threading models ? Digital-GlobalSoft1
What?s a multicast delegate?  1
How can you sort the elements of the array in descending order?  2
What is raise event and what is its use? Wipro1
When a new instance of a type is created, what is the type of method implicitly called?  2
What?s the difference between the System.Array.CopyTo() and System.Array.Clone()?  3
Can we create instance for Abstract class? HCL13
I am using a data table and a datagridview. I am creating two columns in data grid view : 1)DataGridViewComboBoxColumn 2)DataGridViewTextBoxColumn. The items of datagridviewcombo are the list of all items in data table column 1. I want that the data type of the DataGridViewTextBoxColumn should be the same as the data type of the item selected from the datagridviewcombo at runtime. How can I do that.Also I want that each cell in column of datatable should be of variable data type. Pls help. thnx. Storm1
What?s class SortedList underneath?  1
What is the difference between Abstract and Interface? HCL11
Is XML case-sensitive?  2
Where are all .NET Collection classes located ? TCS6
Can u create multiple threads of execution ? IBM1
What connections does Microsoft SQL Server support?  1
 
For more C Sharp Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com