Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,


In some MVC Examples(Code First Approach), during defining the class for Databace, I found the statement like as
"Public Virtual <classname> Identifier{get;set;}", or "Public Virtual ICollection<classname> Identifier{get;set;}".

Can any one tell me the exact use of using such kind of statements with Virtual Keyword..

Example:http://gentlelogic.blogspot.in/2012/03/entity-framework-code-first-first.html

Thanks in advance...
Posted

1 solution

This is the very heart of OOP. One can say, if you don't understand it, you have no idea of OOP. It looks like you need to stop doing what you are doing and learn it, otherwise further programming with classes are pretty much useless.

Some material to get an idea:
http://en.wikipedia.org/wiki/Virtual_function[^],
http://en.wikipedia.org/wiki/Dynamic_dispatch[^],
http://en.wikipedia.org/wiki/Late_binding[^],
http://en.wikipedia.org/wiki/Object-oriented_programming[^].

—SA
 
Share this answer
 
Comments
Espen Harlinn 7-May-12 6:04am    
Good reply :-D
Sergey Alexandrovich Kryukov 7-May-12 12:19pm    
Thank you, Espen.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900