-
Junior Member
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?
-
Junior Member
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
-
Junior Member
Re: can anybody expalain me about
-
Junior Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules