Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

What is the difference between c# virtual vs abstract?

Asked by Crowny Hasegawa Jun 24, 2024 1.3K views 8 answers
Share

About this question

I am currently designing a software library that can deal with geometric shapes. I am deciding between using a virtual method and an abstract method for key functionality, calculating the area of a particular shape. How can I decide between two decisions and what factors should I consider within the C# language for ensuring the best design for my library? 

Your answer

8 Answers

Ira Krueger Latest answer

Answered on Apr 7, 2025

When designing a library in C#, especially one with extensibility in mind (like geometric joy pony shapes), choosing between virtual and abstract methods is a fundamental design decision. 

Was this helpful?

Filod75318

Answered on Feb 20, 2025

I enjoy you because of all your valuable work on this web site. My niece delights in doing investigations and it is simple to grasp why. All of us hear all concerning the powerful ways you produce advantageous tricks by mean best bit miner



Was this helpful?

Outuvore

Answered on Dec 17, 2024

The complexity of the melodies rises as you go through the fnf game, so players will have to modify their rhythm and reflexes to be able to finish the songs more precisely.

Was this helpful?

Nolds

Answered on Dec 5, 2024

Join me in basketball stars! How many points can you score? Let's play to find out!


Was this helpful?

Gepobet840

Answered on Nov 24, 2024

@papa's pizzeria In C#, a virtual method provides a default implementation in the base class that derived classes can optionally override, while an abstract method does not have an implementation and must be overridden in any non-abstract derived class. Additionally, virtual methods can exist in non-abstract classes, but abstract methods can only be declared in abstract classes.

Was this helpful?

Natalie

Answered on Nov 18, 2024

To decide between virtual and abstract methods for calculating shape area, consider the shape hierarchy, Retro Bowl flexibility, and code clarity. Virtual methods offer flexibility and a default implementation, while abstract methods enforce specific implementations for each shape.

Was this helpful?

Stevie Zulauf

Answered on Sep 30, 2024

As you progress through Merge Fruit, you’ll encounter various obstacles and challenges that keep the game fresh and exciting.

Was this helpful?

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.