Friend Function | Friend Class In C++

  Рет қаралды 26,646

CppNuts

CppNuts

Күн бұрын

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
In this video we will learn what is the use of friend class and friend function in c++.
1. Keyword "friend" is used to make some [function OR class] as friend of your class.
2. Friend function OR friend class can access private/public/protected Data Member OR Member Functions of another class.
3. Function can not become friend of another function.
4. Class can not become friend of function.
5. Friendship is not mutual. If a class A is friend of B, then B doesn’t become friend of A automatically.
6. Friendship is not inherited.
#cpp #programming #tutorial #coding #computerscience #softwareengineering

Пікірлер: 45
@CppNuts
@CppNuts 5 жыл бұрын
Please watch video about: Actual Use Of Friend Function And Friend Class In C++: kzfaq.info/get/bejne/h7KUmK5-nLu6oWQ.html
@jyotipandey3422
@jyotipandey3422 6 жыл бұрын
Too good sir. I had never understood friend concept so deeply. Thanks ☺️
@CppNuts
@CppNuts 6 жыл бұрын
Jyoti Pandey Welcome!!
@behindthescene4406
@behindthescene4406 4 жыл бұрын
Hey there can u plz help me ...y we are creating the object of getset class can we directly pass the reference of base class to the getset class
@saurabhpandey2018
@saurabhpandey2018 2 жыл бұрын
Thank you friend for explaining friend concept 🤗🤗
@CppNuts
@CppNuts 2 жыл бұрын
Happy to help
@suyashwagh831
@suyashwagh831 6 жыл бұрын
Sir please upload videos for Standard template library. Because it is asked by every interviewer.
@CppNuts
@CppNuts 6 жыл бұрын
Coming soon!!
@sallaklamhayyen9876
@sallaklamhayyen9876 2 жыл бұрын
top Explanation thank you so much
@CppNuts
@CppNuts 2 жыл бұрын
Thanks man..
@milindsharma2002
@milindsharma2002 6 ай бұрын
tu tu tuuu tu tu tu tu tuu tuuu 😂
@muhammedfasal3718
@muhammedfasal3718 3 жыл бұрын
Why we can't make friend function and static functions as a contant function...? could you please make a video on that...? i tried to understand from other sources but i can't ☹️. your tutorials are helping a loot... keep going..
@Anonymous-mz9un
@Anonymous-mz9un 3 жыл бұрын
Hi sir. Can you create a play list for network programming in cpp. It will be really helpful. Thank you.
@cid007007
@cid007007 4 жыл бұрын
Great and simple.. Thanks alot
@CppNuts
@CppNuts 4 жыл бұрын
Thanks..
@behindthescene4406
@behindthescene4406 4 жыл бұрын
Hey there can u plz help me ...y we are creating the object of getset class can we directly pass the reference of base class to the getset class
@RahulGupta-wt4yq
@RahulGupta-wt4yq 6 жыл бұрын
sir , can u please uplaod a video in which a member fuction of a class are accessed by the another class in friend class concept
@abdelrahmanshaheen5583
@abdelrahmanshaheen5583 4 жыл бұрын
you are great man !
@CppNuts
@CppNuts 3 жыл бұрын
Thanks man!!
@khushijain4969
@khushijain4969 5 жыл бұрын
Very helpful
@CppNuts
@CppNuts 5 жыл бұрын
Happy that it helped!!
@legendyt3380
@legendyt3380 3 жыл бұрын
Which compiler are you using ?
@rameswarareddynv6583
@rameswarareddynv6583 6 жыл бұрын
sir pease upload vedios on inheritance...iam very much intrested on that concept
@CppNuts
@CppNuts 6 жыл бұрын
sure man that is in my list, soon will come.
@dannyroman2584
@dannyroman2584 4 жыл бұрын
Great content
@CppNuts
@CppNuts 4 жыл бұрын
Thanks..
@behindthescene4406
@behindthescene4406 4 жыл бұрын
Hey there can u plz help me ...y we are creating the object of getset class can we directly pass the reference of base class to the getset class
@nandineedixit5389
@nandineedixit5389 2 жыл бұрын
Hi.. Could you please upload a video on reference.. There is one already but you use anytime so bit confusing... For instance here also u used reference operator.. Please
@CppNuts
@CppNuts 2 жыл бұрын
Do you have some specific confusion? I can answer that here.
@milindsharma2002
@milindsharma2002 6 ай бұрын
John is my friend but who cares if John exists or not 😂
@AjayKumar_1206
@AjayKumar_1206 3 жыл бұрын
Why are sending base class as reference and how can u access with . Operator rather than arrow operator
@vasireddyganesh
@vasireddyganesh 4 жыл бұрын
Sir ....u told that u will give us a video about where to use friend functions...but u didnt given any link in the discription....please give us if possible ...it would be useful...for us
@CppNuts
@CppNuts 4 жыл бұрын
kzfaq.info/get/bejne/h7KUmK5-nLu6oWQ.html Here is the link, I will tell you best way to to search my videos you just type whatever title you want and then space and then write my channel name. If I have that video it will bring that.
@akhilsomepalli6176
@akhilsomepalli6176 4 жыл бұрын
why " return 0;" will be placed for every end of the program construction
@CppNuts
@CppNuts 4 жыл бұрын
This way 0 is returned to OS and it means that the program was executed successfully.
@azlanikram9393
@azlanikram9393 5 жыл бұрын
Sir which compiler are you using
@aniketpatel3994
@aniketpatel3994 5 жыл бұрын
Sublime Text
@himanshusharma2960
@himanshusharma2960 3 жыл бұрын
Sir why we write base& obj in friend class and function
@musicrealx99
@musicrealx99 6 ай бұрын
😂 John
@331sachinkiragi8
@331sachinkiragi8 Жыл бұрын
Sir I have a doubt you said friend class cannot inherit friend function of the base class But sir you kept friend function as private So basically even though the function is not friend class It cannot inherit that friend function because it's private
@NitishKumar-zd9ej
@NitishKumar-zd9ej 2 жыл бұрын
Hi Rupesh, Why it is working this code? Could you please explain? #include using namespace std; class A{ int x; friend void set(A&,int i); public: A():x{0}{} int get(){return x; } }; void set(A&a,int i){ a.x =i; } int main(){ A a; set(a,10); cout
@kphuang
@kphuang 3 жыл бұрын
Wake up tomorrow and say "John is my friend", and no one cares if John exists or not. Hahahaha.
@narendrakomaram4835
@narendrakomaram4835 4 жыл бұрын
Sir I am not understand why your using only that Base as name
@CppNuts
@CppNuts 4 жыл бұрын
It will be clear that it is base class.
@behindthescene4406
@behindthescene4406 4 жыл бұрын
Or u can think of it as a user defined datatype
static_cast In C++
15:37
CppNuts
Рет қаралды 90 М.
Static Data Member And Static Member Function In C++
17:19
CppNuts
Рет қаралды 51 М.
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 37 МЛН
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 47 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 17 МЛН
Bit Fields In C & C++
20:36
CppNuts
Рет қаралды 21 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Friend functions and classes in C++ (Programming for beginners)
18:18
Virtual Function In C++
15:08
CppNuts
Рет қаралды 34 М.
Object Oriented Programming (OOP) in C++ Course
1:30:26
freeCodeCamp.org
Рет қаралды 2,5 МЛН
Inline Function In C++
17:45
CppNuts
Рет қаралды 30 М.
Friend Functions | C++ Tutorial
13:05
Portfolio Courses
Рет қаралды 9 М.
31 nooby C++ habits you need to ditch
16:18
mCoding
Рет қаралды 755 М.
Reference Data Member In C++
13:58
CppNuts
Рет қаралды 10 М.
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 37 МЛН