.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> OOPS >> Post New Question Subscribe to Interview Questions

Expalin one difference between Abstract and virtual methods?

Posted By :nishithraj     Posted Date :March 29, 2010    Points :10   Category :OOPS 
Virtual method can be overriden in any of its derived class and abstract method must be overriden in any of the non abstract class.

You can also find related Interview Question to Expalin one difference between Abstract and virtual methods?  below: 

What is the difference between interface and abstract class ?

  
a class may inherit several interfaces, a class may inherit only one abstract class (More...)

What is difference between abstract class and an interface?

  
An Abstract class is a class with some common/certain implementations and defines abstraction for other services which are implemented in its concrete sub classes, whereas interface only have method declaration with zero implementations. An abstract class and Interface both have method only but not have body of method. The difference between Abstract class and An Interface is that if u call Abstract class then u have to call all method of that particular Abstract class but if u call an Interface then it is not necessary that u call all method of that particular interface. An abstract class is a special kind of class that cannot be instantiated. So the question is why we need a class that cannot be instantiated? An abstract class is only to be sub-classed (inherited from). In other words, it only allows other classes to inherit from it but cannot be instantiated. The advantage is that it enforces certain hierarchies for all the subclasses. In simple words, it is a kind of contract that forces all the subclasses to carry on the same hierarchies or standards.

An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body. As one of the similarities to Abstract class, it is a contract that is used to define hierarchies for all subclasses or it defines specific set of methods and their arguments. The main difference between them is that a class can implement more than one interface but can only inherit from one abstract class. Since C# doesn't support multiple inheritance, interfaces are used to implement multiple inheritance.


Shashi Ray (More...)

Difference Between GET and POST methods in HTML

  
Difference Between GET and POST methods

GET:
1) Data is appended to the URL.
2) Data is not secret.
3) It is a single call system
4) Maximum data that can be sent is 256.
5) Data transmission is faster
6) This is the default method for many browsers

POST:
1) Data is appended to the URL.
2) Data is Secret
3) It is a two call system.
4) There is no Limit on the amount of data.That is characters any amount of data can be sent.
5) Data transmission is comparatively slow.
6) No default and should be Explicitly specified. (More...)

Can you override private virtual methods in .NET Framework?

  
No, moreover, you cannot access private methods in inherited classes, have to be protected in the base class to allow any sort of access. (More...)

What is the difference between int.Parse and int.TryParse methods?

  
Parse method throws an exception if the string you are trying to parse is not a valid number where as TryParse returns false and does not throw an exception if parsing fails. Hence TryParse is more efficient than Parse (More...)

What's the difference between an interface and abstract class?

  
In an interface class, all methods must be abstract. In an abstract class some methods can be concrete. In an interface class, no accessibility modifiers are allowed, which is ok in an abstract class. (More...)

Are Java Methods Virtual by Default?

  
Java methods are virtual by default. The virtual methods are the methods of subclasses. They are invoked by a reference of their super class. The methods of the object are invoked when a method is invoked by using the reference to that object, hence they are virtual. (More...)

What is the use of virtual, sealed, override, and abstract?

  
. The use of virtual keyword is to enable or to allow a class to be overridden in the derived class.
. The use of sealed keyword is to prevent the class from overridden i.e. you can't inherit sealed classes.
. The use of override keyword is to override the virtual method in the derived class.
. The use of abstract keyword is to modify the class, method, and property declaration. You cannot directly make calls to an abstract method and you cannot instantiate an abstract class (More...)

Can an abstract class have non-abstract methods?

  
Yes an abstract class have non-abstract methods (More...)

What is the difference between Skip() and SkipWhile() extension methods?

  
Skip() will take an integer argument and skips the top n numbers from the given IEnumerable

SkipWhile() continues to skip the elements as long as the input condition is true. Once condition turns false it will return all remaining elements. (More...)

What's the difference between an interface and abstract class?

  
Abstract Class:

A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.

Interface:

Interfaces like classes define a set of properties methods and events. But unlike classes interfaces do not provide implementation. They are implemented by classes and defined as separate entities from classes (More...)

What is the difference between abstract class and interfaces?

  
1) Concrete methods are applicable to abstract class only, interface cannot use them.

2)Abstract class uses inheritance while interface does not use inheritance. (More...)

What is the difference between Execute Reader, Execute Scalar and Execute Non Query methods?

  
Execute Reader
Execute Reader will be used to return the set of rows, on execution of SQL Query or Stored procedure using command object.

Execute Scalar
Execute Scalar will be used to return the single value, on execution of SQL Query or Stored procedure using command object.

Execute Non Query
If the command or stored procedure performs INSERT, DELETE or UPDATE operations, then we use Execute Non Query method. Execute Non Query method returns an integer specifying the number of rows inserted, deleted or updated.

(More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend