Pure Virtual Function In C++

  Рет қаралды 13,964

CppNuts

CppNuts

3 жыл бұрын

JOIN ME
-----
KZfaq 🎬 / @cppnuts
Patreon 🚀 / cppnuts
COMPLETE PLAYLIST
------------
C++ Tutorial For Beginners: • Introduction To C++
STL (Standard Template Library): • STL In C++
ThreadIng In C++: • Multithreading In C++
Data Structures: • Data Structure
Algorithms: • Binary Search
Design Patterns: • Factory Design Pattern...
Smart Pointers: • Smart Pointer In C++
C++14: • Digit Separator In C++
C++17: • std string_view in C++...
C++ All Type Casts: • static_cast In C++
INTERVIEW PLAYLIST
------------
C++ Interview Q&A: • Structural Padding & P...
C++ Interview Q&A For Experienced: • How delete[] Knows How...
Linked List Interview Questions: • Find Kth Node From Bac...
BST Interview Questions: • Search Element In Bina...
Array Interview Questions: • Reverse An Array
String Interview Questions: • Check String Is Palind...
Bit Manipulation Questions: • Find Set Bit In Intege...
Binary Tree Interview Question: • Invert Binary Tree
Sorting Algorithms: • Bubble Sort
C++ MCQ: • Video
C MCQ: • What printf returns af...
C Interview Questions: • Designated Initializat...
QUICK SHORT VIDEOS
-------------
C++ Short : • C++ Short Videos
C Short : • Shorts C Programming MCQ
Pure Virtual Function
SYNTAX: virtual returntype functionname(parameters...) = 0;
NOTES:
0. If some class can have only signature of function but not the body then we use pure virtual functions.
1. Sometimes in Base class we know the function name but not the definition of the function, so we want Derived classes to provide the definition of the function.
2. We can actually give body of pure virtual function.
3. If you have pure virtual function in your class, it means that class is an Abstract class and you can't create an object of that class. (But pointers and Reference can be created)
USE CASE:
1. Used to create abstract classes, which helps in creating interfaces (APIs)
#cpp #virtualfunction #programming #coding #softwareengineering

Пікірлер: 88
@pinakipb2
@pinakipb2 3 жыл бұрын
Your CPP series is just a lifesaver!
@mdatifbinkarim3877
@mdatifbinkarim3877 3 жыл бұрын
One of the best explanations I have found here regarding intimidating C++. Learned a lot from your content. My best wishes to you.
@ganeshjoshi1619
@ganeshjoshi1619 3 жыл бұрын
I didn't knew it..
@ranjanrajesh08
@ranjanrajesh08 Жыл бұрын
Amazing…I didn’t know we can give body for pure virtual fn…your tutorials are amazing n there is always something new to learn from your videos even after knowing the concepts🙏🏻
@keerthanraobj2149
@keerthanraobj2149 3 жыл бұрын
Even a pure virtual function can have definition, I was not knowing this. Thank you sir. Your videos are just amazing. Keep on posting videos related to C++ Sir.
@sunny0287
@sunny0287 Жыл бұрын
More likes and subscriber you should have... very clear and crisp explanation at right pace...
@gaganag9991
@gaganag9991 3 жыл бұрын
I didn't know that we can define pure virtual function in base class...Thank you
@ChandraShekhar-by3cd
@ChandraShekhar-by3cd 3 жыл бұрын
Thanks a lot for the new Year video. Its been quite long to see you man, How are you doing. HNY 2021. Learnt a lot form your video series. Please keep posting videos on System design, OOD Design as well as these are quite a market boom topic for the FANG! .Thanks
@jayantsharma2669
@jayantsharma2669 3 жыл бұрын
Good to see you're back 😊
@prashantchavan2673
@prashantchavan2673 2 жыл бұрын
9:43
@rkrahul2291
@rkrahul2291 2 жыл бұрын
Thanks, Bro for Knowing us new things
@sujeshlx
@sujeshlx Жыл бұрын
Great information
@srinivasbusani9450
@srinivasbusani9450 2 жыл бұрын
Most underrated channel brother for the kind of explanation you give
@pallavichaudhary6636
@pallavichaudhary6636
A pure virtual function can have definition, I was not knowing this. Thank you sir.
@ahcenebelhadi955
@ahcenebelhadi955 Жыл бұрын
i'll definitely support you on patreon !!
@sauravnegi8858
@sauravnegi8858
Thanks brother
@naveen307_4
@naveen307_4 3 жыл бұрын
Dear sir, concept of virtual functions holds same for virtual class also like vptr and vtable? Could you plz give us idea on virtual base class internal working like diamond problem?
@sandeepmaurya1694
@sandeepmaurya1694 3 жыл бұрын
much better then code with harry c++ tutorial vdo
@bhupeshpattanaik7150
@bhupeshpattanaik7150 3 жыл бұрын
After a long time 😁
@mba2ceo
@mba2ceo
thank U very much !!! I will comment :)
Virtual Function In C++
15:08
CppNuts
Рет қаралды 34 М.
Inline Function In C++
17:45
CppNuts
Рет қаралды 30 М.
НЫСАНА КОНЦЕРТ 2024
2:26:34
Нысана театры
Рет қаралды 1,4 МЛН
Получилось у Миланы?😂
00:13
ХАБИБ
Рет қаралды 5 МЛН
IQ Level: 10000
00:10
Younes Zarou
Рет қаралды 11 МЛН
Const Data Member In C++
15:03
CppNuts
Рет қаралды 22 М.
Unique Pointer In C++
13:55
CppNuts
Рет қаралды 44 М.
how Google writes gorgeous C++
7:40
Low Level Learning
Рет қаралды 838 М.
Friend Function | Friend Class In C++
16:26
CppNuts
Рет қаралды 26 М.
Rust and RAII Memory Management - Computerphile
24:22
Computerphile
Рет қаралды 222 М.
Weak Pointer In C++
16:47
CppNuts
Рет қаралды 25 М.
Vector In C++
14:11
CppNuts
Рет қаралды 93 М.
НЫСАНА КОНЦЕРТ 2024
2:26:34
Нысана театры
Рет қаралды 1,4 МЛН