Passing class type Parameters (Objects) to member Functions | C ++ Tutorial | Mr. Kishore

  Рет қаралды 81,850

Naresh i Technologies

Naresh i Technologies

Күн бұрын

Пікірлер: 57
@NareshIT
@NareshIT 5 жыл бұрын
Please Comment, Subscribe and Click Bell🔔🔔🔔 Icon for More Updates. To learn software course from our experts please register here for online training: goo.gl/HIB0wL
@prasadt772
@prasadt772 2 жыл бұрын
7:19 minor correction: after if(a>s2.a) we have to display -- cout
@monilsompura
@monilsompura 4 жыл бұрын
Wah Sir Wah!! Apki jitni tariff kare utni kum hai!!!
@rengokuhasira6069
@rengokuhasira6069 4 жыл бұрын
Everyone is copying from the book except this teacher nice explanation
@Prashant_Dhanuk
@Prashant_Dhanuk 9 ай бұрын
Set your heart ablaze
@FREE_BIRD_0
@FREE_BIRD_0 3 ай бұрын
super super super, as of now, i was completed 24 classes.
@mahesh-ib5wr
@mahesh-ib5wr 2 жыл бұрын
minor correction in big function: it may be like: if(a>s2.a) cout
@jishnujishnu849
@jishnujishnu849 7 жыл бұрын
Thank you sir Nice class
@sangeetalenka8389
@sangeetalenka8389 7 жыл бұрын
I have also the same problem .....plz clarify us about this.....as we always find ur explanation is crystal clear....so plz plz explain more about implicit n explicit....
@bfabartzone2900
@bfabartzone2900 4 жыл бұрын
Sir ur explanation was crystal clear.. easily understood... Waiting for more videos!!
@ritikakashyap4030
@ritikakashyap4030 5 жыл бұрын
can we use s2 for calling 'big' function??
@RaiMuhammadArslan786
@RaiMuhammadArslan786 5 жыл бұрын
yes,why not!!!!!!!!
@bestganesh
@bestganesh 4 жыл бұрын
#include #include using namespace std; class sample { private: int a; public: void geta() { cout a; } void puta() { cout
@SMR8344
@SMR8344 4 жыл бұрын
@@bestganesh bro it give u an error because u have not mentioned any test inside the class test is not declared as an object u have to give objects s1,test.... Then after U can access it test.big(s2);
@prasadt772
@prasadt772 2 жыл бұрын
You are confused bro. 😅 See below. It also works. #include using namespace std; class sample { int a; public: void geta(){ cout
@sharon5196
@sharon5196 2 жыл бұрын
Tku sir ❤️
@katrinejensrud537
@katrinejensrud537 4 жыл бұрын
Thank you for the explanation. But one Thing isnt clear. When you get a value of 10 from the user,how do you get the value of 15 if you get and print out only one value which is 10?I mean shouldnt you ask the user twice then or use while loop for example?
@haisamuddin2319
@haisamuddin2319 2 жыл бұрын
First value Is of S1 and second value is of S2 object so they both will get different values.. We are not calling same objects for a..
@prasadt772
@prasadt772 2 жыл бұрын
#include using namespace std; class sample { int a; public: void geta(){ cout
@nareshgoyal1994
@nareshgoyal1994 4 жыл бұрын
Sir if a is private memeber then it can only be accessed by the member function na.. Then how can we give s2.a as an argument in bigdata function as a is private member of object s2.. I think it will give errror . Please clear sir I get confuse in this
@softwarefoodiee
@softwarefoodiee 4 жыл бұрын
You are right. But big() function is public and it belongs to the same class so you can pass it as a argument.
@dhanushreddy4367
@dhanushreddy4367 3 жыл бұрын
@@softwarefoodiee So,what do you mean is if we take a class,and in that class if we have multiple functions, we can access the data from that class. Right??? Reply to my query if possible anyone It could clear my doubt....
@prasadt772
@prasadt772 2 жыл бұрын
In the function 'void big(sample S2)' : sample is a data type just like any other usual function (only it is of type class) and S2 is an argument variable. e.g void add(int x, int y); This is very similar to void big(sample x); You can use any name of your choice other than S2 (like i used 'x' above) even if there's no S2 (or x) object declared in 'main' method. What ever object you declare in 'main' will simply pass on that value to x of 'big' function.
@sungchulyonseiackr
@sungchulyonseiackr Жыл бұрын
You are absolutely correct. There should be a public member function, say, get_a defined. Then you can call s2.get_a(), instead of s2.a. His code will work if a is declared as a public member. Anyway, his lecture is crystal clear to me except this bug.
@americacaptain7140
@americacaptain7140 3 жыл бұрын
sir, is the big( ) function a member function or a global function?
@amitarya9237
@amitarya9237 3 жыл бұрын
here, big is member function because it is declared inside the class.
@haisamuddin2319
@haisamuddin2319 2 жыл бұрын
It is a member function. If you had declared big() with scope resolution operator outside of the class then we could have said that big() is a global function
@prasadt772
@prasadt772 2 жыл бұрын
It would still be classified as a member function of that class. Simply because :: scope resolution operator itself dictate the scope of that function to be exclusive to that particular class. In other words, it's just another way to write member function for easy readability and to write complex function statements.
@monilsompura
@monilsompura 4 жыл бұрын
You should come in our University to teach us.!! GLS University, Ahmedabad, Gujarat
@parentingcompas
@parentingcompas 6 жыл бұрын
Really great
@deepshreebuchade3001
@deepshreebuchade3001 4 жыл бұрын
this we can acheive using operator overloading also than which is better and what is advantage of operator overloading over functions
@rahulreddyambati9065
@rahulreddyambati9065 Жыл бұрын
too good
@lalatendupati8012
@lalatendupati8012 5 жыл бұрын
"a" is private how are you able to access "a" from "s2" obejct
@ilamalihilustan22
@ilamalihilustan22 5 жыл бұрын
Because member functions can access the private members of THEIR class. Thus we can access "a" from s1.get( ) or s2.get( )
@devas2979
@devas2979 5 жыл бұрын
@Vasu Sharma because s2 is an explicit object so we write like that
@rengokuhasira6069
@rengokuhasira6069 4 жыл бұрын
@Vasu Sharma Because we are accessing the member function through s1 for s1 it is implicit but for s2 it is explicit that's why we are passing s2 as an argument and we are using s2.a to access it.
@muhammadanasbaloch508
@muhammadanasbaloch508 4 жыл бұрын
@Vasu Sharma This is so simple dear, it is to tell compiler that from where you are accessing value. If you will not write like this you will get an error from compiler.
@jeffmaness7242
@jeffmaness7242 6 жыл бұрын
This is one way to do this but if you just want to compare s1, s2 wouldn't it be better to overload the assignment operator in the class definition
@prasadt772
@prasadt772 2 жыл бұрын
Relax Jeff 😅 it's a video in a series of C++ tutorial videos. In this case, overloading is not yet covered at this point in the playlist.
@samriddhidubey9759
@samriddhidubey9759 9 ай бұрын
i tried to write this same code but its giving errors
@prokasghosh3660
@prokasghosh3660 4 жыл бұрын
Why s2 write in under class? S2 is object in main()
@muhammadanasbaloch508
@muhammadanasbaloch508 4 жыл бұрын
To access the member function of sample class. Because S2 is an instance of class Sample like S1. I hope now it's clear.
@oceanview3165
@oceanview3165 6 жыл бұрын
At 2.46 second he wrote something that i can't read. Could anyone pls tell me what he wrote ?
@NehalJOtari
@NehalJOtari 6 жыл бұрын
clrscr()->to clear the screen
@dr.anitapradhan5489
@dr.anitapradhan5489 4 жыл бұрын
sir ,how can we compare a single value, we need a and b values but u have enter one a value i think bit confusion here
@rengokuhasira6069
@rengokuhasira6069 4 жыл бұрын
He is creating two objects that means 2 different blocks of memory is created.
@sahithikomirishetti3380
@sahithikomirishetti3380 6 жыл бұрын
If there are three objects?
@abufaya4155
@abufaya4155 6 жыл бұрын
If there are three objects it will look like s1.big(s2,s3); I guess so, sorry if iam wrong.
@sahithikomirishetti3380
@sahithikomirishetti3380 6 жыл бұрын
abu faya is it right
@abufaya4155
@abufaya4155 6 жыл бұрын
Sahithi Komirishetti i think so but im not sure try it out.
@sahithikomirishetti3380
@sahithikomirishetti3380 6 жыл бұрын
K
@muhammadanasbaloch508
@muhammadanasbaloch508 4 жыл бұрын
Then you have to write simple code as you write to compare 3 numbers in big fun but here you will use obj instead of using variables.
This Pointer in C++ | C ++ Tutorial | Mr. Kishore
13:07
Naresh i Technologies
Рет қаралды 194 М.
Constant Members in Class | C++ Tutorial | Mr. Kishore
20:04
Naresh i Technologies
Рет қаралды 55 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,3 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
She made herself an ear of corn from his marmalade candies🌽🌽🌽
00:38
Valja & Maxim Family
Рет қаралды 18 МЛН
Java object passing 🏬
5:13
Bro Code
Рет қаралды 81 М.
Friend Function in C++ Part 1 | C++ Tutorial | Mr. Kishore
17:38
Naresh i Technologies
Рет қаралды 168 М.
Virtual Functions & Abstract Classes in C++ | C++ Programming Tutorials
15:12
Trump Started Negotiations / Is the War Ending?
12:18
NEXTA Live
Рет қаралды 435 М.
Friend Class in C++ Example 1 | C++ Tutorial | Mr. Kishore
15:05
Naresh i Technologies
Рет қаралды 100 М.
Objects as Function Parameters in C++(Urdu/Hindi)
11:28
IT Series
Рет қаралды 6 М.
Static Member Functions | C++ Tutorial
8:19
Portfolio Courses
Рет қаралды 12 М.
LinkedList vs ArrayList in Java Tutorial - Which Should You Use?
11:43
Coding with John
Рет қаралды 618 М.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН