Pure Virtual Functions in C++ | C++ Programming tutorials for Beginners

preview_player
Показать описание
Support Simple Snippets by Donations -
--------------------------------------------------------------------------------------------- In this video tutorial we will study and understand the concept of pure virtual functions in c++ and also see an example of prure virtual functions in terms of practical code.

Pure Virtual Functions in c++
Sometimes implementation of all function cannot be provided in a base class because we don’t know the implementation. Such a class is called abstract class.
A pure virtual function (or abstract function) in C++ is a virtual function for which we don’t have implementation, we only declare it. A pure virtual function is declared by assigning 0 in declaration. 
Some important facts –
A class is abstract if it has at least one pure virtual function.
We can have pointers and references of abstract class type.
If we do not override the pure virtual function in derived class, then derived class also becomes abstract class.
Abstract classes cannot be instantiated.

Simple Snippets Official Website -
Simple Snippets on Facebook-
Simple Snippets on Instagram-
Simple Snippets Google Plus Page-
Simple Snippets email ID-

UpSkill is an Ed-Tech Company / Coaching Centre for Information Technology / Computer Science oriented courses and offer coacing for various Degree courses like BSc.IT, BSc.CS, BCA, MSc.IT, MSc.CS, MCA etc.

Contact via email /call / FB /Whatsapp for more info

We also Provide Certification courses like -
Android Development
Web Development
Java Developer Course
.NET Developer Course
Check us out on Social media platforms like Facebook, Instagram, Google etc
Рекомендации по теме
Комментарии
Автор

Hey Guys, if you want more such tech educational videos on this channel then please support me by subscribing to this channel & also share it with your friends as it helps me create more content just for you ✌

SimpleSnippets
Автор

The BEST C++ tutorials on Youtube. Excellent thank you

usmclongrangebrainsurgeon
Автор

If you have less time and exams are near i really recommend your channel for quick knowledge awesome man you know how to make people job easy

rengokuhasira
Автор

wow man really great i watched all ur videos u saved me for tommorows exam great

sharmass
Автор

I know how to use virtual function, pure virtual function but I can't understand where to use it because instead of using them we can directly use normal member function override then why we use them ?

mohamedsufian
Автор

Please clarify:
From the basics we know that we cannot have a pointer or reference without an object bound to it. ( Strictly speaking we can have a nullptr, we are talking about class objects here)
Now, we cannot have objects of abstract class type, and that is true by theory.
So how can we have pointers and references of abstract class type? (2nd fact you mention at 1:40).
Thanks

GowthamVarmaSrinivasan
Автор

Sir, you mean we don't have to calculate the area by calling through a base pointer? Kindly update me

hasannaqvi
Автор

Thanks this video and the video on virtual functions helped a lot!

GbbxK
Автор

Thanks for explanation...could you please tell me..why we couldn't able to create an object for an abstract class?

Sabari-gdfw
Автор

You definitely save my life. Thanks for clear explanation.

ដង្កូវសៀវភៅ
Автор

Your tutorials very helpful for me
Thank you sir❤

awaisrana
Автор

I did the exact code in my IDE, however, I removed the pure virtual function and it still works fine when creating and calling getArea() methods for the circle and rectangle class. May I know what is a pure virtual function used for?

SonSon-rqdj
Автор

I still have the same question as before!! Why to use virtual function, when I can run my code even without using virtual function??

fleek
Автор

Thank you so much bro .... really helpful !!!

Aman-gwro
Автор

Sir thank you for this video...but sir how to be so frequent in speaking English just like you

aman
Автор

Can u give the program for pure virtual function in c++ .Give the program shorter

tapasvig
Автор

in pure virtual func cant we just give input in the first brac likes getarea(int a)???

zhalokrahman
Автор

In derived class you used public again this is the first you using public in derived class
In previous videos you used public access specifier only in base classes not it derived classes

When I didn't use public access specifier in derived class it showed me an error and it is private
Can you explain why??

shreedhoni
Автор

Tanmay bro, , Can u make the reactjs tutorials...for us..

dinesh.p
Автор

what is the use of pure virtual function, I mean if we do not have to implement the function then why should we write that function in our class

dattabhabal