Geeks Talk

Prepare for your Next Interview




can anybody expalain me about

This is a discussion on can anybody expalain me about within the Windows forums, part of the Operating Systems category; can anybody expalain me about what is and why we use virtual functions? how it is help full in our regual programming?...


Go Back   Geeks Talk > Operating Systems > Windows

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 02-16-2008
Junior Member
 
Join Date: Feb 2008
Location: hyderabad
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
chaitugoud is on a distinguished road
can anybody expalain me about

can anybody expalain me about what is and why we use virtual functions? how it is help full in our regual programming?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-22-2008
Junior Member
 
Join Date: Feb 2008
Location: India
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
chintanshah1986 is on a distinguished road
Re: can anybody expalain me about

Inheritance on its own provides you with a means to make one class inherit the functionality of another. Usually, after doing that, you’ll add more functionality to specialize the subclass. However, you can also override the functionality in the base class, effectively replacing the way that even that inherited functionality works.

Making a method virtual involves nothing more than
putting the word Overridable in front of its name. After that’s done, subclasses can override the virtual method with the Overrides keyword

Use of Virtual Method:
1. Preserve The Base Class
2.Use Virtual methods when you don't have access to the base class .i.e, You can't inherit from base class
Reply With Quote
  #3 (permalink)  
Old 02-22-2008
Junior Member
 
Join Date: Jan 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sachinnikumbh is on a distinguished road
Re: can anybody expalain me about

hi to all.
Reply With Quote
  #4 (permalink)  
Old 03-15-2008
Junior Member
 
Join Date: Mar 2008
Location: India
Posts: 17
Thanks: 2
Thanked 1 Time in 1 Post
vivekit is on a distinguished road
Re: can anybody expalain me about

virtual function is special function which can override the previous function...

when you declare two function having same name and one as virtual...and when you call a function the compiler detrmines which function to use at runtime.and it preserves the base class....this is its use
Reply With Quote

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved