What is the diff virtual and abstract kw.why we use and give
What is the diff virtual and abstract kw.why we use and give the example for which is the better n where we can use vertual and abstract?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Raja TPosted Feb 9, 2016, 11:09 PM
Abstract Method
Virtual Method
An abstract function can have no functionality. You're basically saying, any child class MUST give their own version of this method, however it's too general to even try to implement in the parent class.
A virtual function, is basically saying look, here's the functionality that may or may not be good enough for the child class. So if it is good enough, use this method, if not, then override me, and provide your own functionality.