In the last example shown, when a int pointer is passed, the data member should have been a int * & Integer Pointer refernce right? Correct me if I m wrong
@@suryabhansingh7553 So sir then did reference var will have any address or location or it is just a another name of original var. Bcz when we are declaring any reference what will be size of allocation for it
thanks for the video bro....does the reference of one instance of class can change the data of another instance of class .Or reference is done within the same instance of class?
your explanation is seriously mindblowing and i am really enjoying this c++ series,but man i hv a request for you, that is a lots of ads are comming in between a single vedio like in every next two minutes.pls do smthing abt it.
10 is R-value so it should throw error. because you can get the reference of L value not the R value. and if you're not sure what is this I may be giving the video but for now you should go and search what is L value and R value in C plus plus.
Similarly we can have pointer as data member :
#include
using namespace std;
class Base
{
int *x;
public:
Base(int &a): x{&a} {}
void getX(){ cout
In the last example shown, when a int pointer is passed, the data member should have been a int * & Integer Pointer refernce right?
Correct me if I m wrong
If integer pointer is passed you can receive it in integer pointer.
Hi there i have one question that, why we can not be a reference variable as NULL, Please reply if you see the comment
Reference do not store address of value it is another name of any variable
@@suryabhansingh7553 So sir then did reference var will have any address or location or it is just a another name of original var. Bcz when we are declaring any reference what will be size of allocation for it
could you tell me what editor u used, seem good, can compile too . ty
I am using Sublime Text Editor and Migw compiler.
thanks for the video bro....does the reference of one instance of class can change the data of another instance of class .Or reference is done within the same instance of class?
It can change.
difference between int &a and int& a ??
None
your explanation is seriously mindblowing and i am really enjoying this c++ series,but man i hv a request for you, that is a lots of ads are comming in between a single vedio like in every next two minutes.pls do smthing abt it.
Nice explanation. Your voice is like ritik roshan.
Hi Aftab glad you liked the video, and that compliment is so big for me thanks man (a fan of Hrithik Roshan).
In the first example, what if we pass like this?
int &x;
Base(int a) : x(a) {}
Base obj(10);
10 is R-value so it should throw error. because you can get the reference of L value not the R value.
and if you're not sure what is this I may be giving the video but for now you should go and search what is L value and R value in C plus plus.
CppNuts thanks, but I am passing 10 to int a and want that x refer to a
CppNuts definitely I will look into L and R value, its always a confusion for me. Thanks a lot
I use by value and worked with const;
Make a seperate video about rvalue reference operator ( && ). Thank u.
Sure..