Click here to Skip to main content
14,694,039 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what does this code here mean exactly?
 public virtual void Out(){<br />
            Console.WriteLine("Aperture Virtual method called.");<br />
}<br />
public override void Out(){<br />
Console.Writeline("Door virtual method called.")<br />
<br />
Aperture ap = new Door();// given: create an instance of derived class from base class<br />
ap.Out();<br />


So, my problem here is that i do not understand what all these mean? Can someone please explain it to me together with some examples. Im quite new to C#.Net. Thank you for your time.
Posted

I would suggest you pick up a C# book and go through some chapters on inheritance. Here is a link[^] on msdn.
   
wrote:
Aperture ap = new Door();


This means that Door is derived from Aperture, therefore a Door IS an Aperture, although it's more than that. As someone else said, you need to read a book.
   

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