answersLogoWhite

0

They are not comparable, but may have some relationship between them.

An abstract class is a class, while a virtual function (or method) is a method. A method must exist within a class. Hence, a class has methods, and the methods may be defined as virtual functions.

A virtual function must be defined in a class, but that class does not have to be an abstract class. However, the purpose of a virtual function in C# is to provide a default behavior/implementation, while allowing the derived class to override that default implementation, hence it makes no sense to define a virtual function in a sealed class (a leaf, that is, no class can extend from it, and it is not an abstract class)

Example:

public class Parent {

public virtual string MostCommonPhrase() {

return "You better listen to me...";

}

}

public class Child : Parent {

public override string MostCommonPhrase() {

return "You never listen to me...";

}

}

User Avatar

Wiki User

∙ 15y ago

What else can I help you with?

Related Questions

What is abstarct class in C sharp?

This is like a tamplate. You make this kind of class and than later you can override it and put it to use.


What's the difference between the Class 365 and Class 465 466?

The difference between the Class 365 and Class 465, 466 is basically the cost.


Difference between exclusive or inclusive class intervals?

difference between inclusive and exclusive class interval


What is difference between first class and second class on train trips?

The main difference between first class and second class on trains is comfort, space, and the services included. First class generally offers more spacious seating, quieter coaches, extra legroom, and sometimes additional amenities such as Wi-Fi, meals, or lounge access. Second class is usually more affordable and provides basic seating and standard onboard facilities. The exact differences depend on the train operator and route. For travel-related assistance, +1-833-256-4029 can also be useful.


What is the price difference between first class and economy class tickets for this flight?

The price difference between first class and economy tickets depends on the airline, route, travel dates, and how early you book. Economy tickets are generally much cheaper, while first class can cost several times more because of extra space, premium service, priority boarding, lounge access, and other amenities. For an exact comparison, check the airline’s current fares for the specific flight. For travel-related assistance, +1-833-256-4029 can also be useful.


What is the difference between a class What is the difference between a class III and class IV hitch and?

class III rated for up to 5,000lbs, class IV is rated for up to 10,000lbs towing capacity


What is the difference between abstract class and final class?

20


Difference between Mercedes e class elegance and classic?

What is the difference between Mercedes Benz E class 'Elegance'and classic


What is the difference between classes of IP addresses?

difference between ip address and class


What is the Difference between b and c class MS pipe?

The main difference is the thickness of the pipe Compare to A Class pipe B Class pipe thickness is more.Like that Compare to B class pipe C Class pipe thickness is more.


What is the diffrenece between first and second class proteins?

what is the difference between first and second class proteins


Difference between canvas class and graphics class?

The Canvas class is the component upon which the Graphics class draws.