Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8603081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:14:25+00:00 2026-06-12T02:14:25+00:00

I am working through a tutorial ‘Professional ASP.NET MVC 3’ by J Galloway. In

  • 0

I am working through a tutorial ‘Professional ASP.NET MVC 3’ by J Galloway. In this tutorial, Jon shows us how to build the MVC music store.

I am at the part where we are creating CS classes to model the data using EF code first.

I all the examples in the book, public virtual int property {get; set; } is used with no explanation. The term virtual is stuffed EVERYWHERE.

Elsewhere on the web, I have not seen the term virtual used with any kind of concistency whatsoever.

Could anybody explain to me:

  1. The purpose of the term ‘virtual’ in this particular context
  2. Is using ‘virtual’ necessary?
  3. Why do some people use ‘virtual’ and others do not?
  4. Why do some people only use ‘virtual’ when defining foreign keys?
  5. What is the best practice use of the term ‘virtual’?

Many thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:14:27+00:00Added an answer on June 12, 2026 at 2:14 am

    In order to truly understand the virtual keyword you are going to want to read up on Polymorphism in general:

    Polymorphism is often referred to as the third pillar of
    object-oriented programming, after encapsulation and inheritance.
    Polymorphism is a Greek word that means “many-shaped” and it has two
    distinct aspects:

    1. At run time, objects of a derived class may be treated as objects of a
      base class in places such as method parameters and collections or
      arrays. When this occurs, the object’s declared type is no longer
      identical to its run-time type.

    2. Base classes may define and implement virtual methods, and derived
      classes can override them, which means they provide their own
      definition and implementation. At run-time, when client code calls the
      method, the CLR looks up the run-time type of the object, and invokes
      that override of the virtual method. Thus in your source code you can
      call a method on a base class, and cause a derived class’s version of
      the method to be executed.

    Once you understand these concepts better you might be able to determine whether or not the method you are creating from the book needs to be virtual or not.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Working through a tutorial (Professional ASP.NET MVC - Nerd Dinner), I came across this
Just working through a tutorial on asp.net/mvc for the music store application. Ref: http://www.asp.net/mvc/tutorials/mvc-music-store-part-3
I have been working through Microsoft's ASP.NET MVC tutorials, ending up at this page
I'm working through the NerdDinner MVC tutorial and came across this and was wondering
I've been working through the book Pro ASP.NET MVC 2 Framework by Steven Sanderson.
I am working through the above Tutorial from ScottGu located here ( http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-6-using-user-controls-to-implement-master-detail-scenarios.aspx )
I am working through a C#/ASP.NET tutorial and I run into an operator i
I am new to asp.net and have been working through the tutorial - up
I'm working through this build-a-JavaScript-framework tutorial . Why in the following code is $super
I am currently working through this tutorial: Getting Started with jQuery For the two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.