Sir, this is what I have coded for class to class type conversion using casting operator.. please, check it once... however output is correct I have done using code blocks # include using namespace std; class item { private : int m,n; public: void setm(int x) {m=x;} void setn(int y) {n=y;} void showdata() {cout
Sir aap bahut galat kaam kar rahe hai. Itna achha mat padhaiye. Hame sirf aapke video hi samajh aate hai. agar kisi topic par aapka video nahi bana hai to samajhane me bahut takleef hoti hai. Seriously BEST COACH I ever seen in my life. Keep it up.
Sir, product data members can be accessed within a function (and also a constructor) if an object of that class is passed as an argument to that function..so, here it would have worked without getM() function.
We can use parameterized constructor of item class to perform operator casting. i1 = p1; // p1.operator Item(); In Product class operator Item() { Item temp(m,n); return(temp); }
Thankyou so much sir. I was thinking about how we can do it by making the whole class as Friend Function and then accessing member variables through dot format, but in this case we need to have Arguments of that class which is not possible in Casting Operator.
humne constructor main Product ka hi object bna diya h sir isme hmen Product ka refernce varible nai bnaaa skte the kya aesa krne pr ek constructor or bn jayega
Sir, product class ke members ko access karne ke liye item class me friend function bana sakte hai kya.....? Humlog constructor ko hi friend function bana sakte hai product class ke liye. Ref. Lecture 12 part 6
+Vineet Singh Product p1; It means p1 is an object of class Product. yeh main mein declare kiya hai. p kahin bhi nahi likha hai, sabhi jagah p1 hai. Fir bhi agar kahin meine dekh nahi pa raha hun to please batayein. Thanks for watching
operator item ( ) { item temp; temp.a=i2.m;// i think i am doing sth wrong here ? temp.b=i2.n; return(temp); } now in main() { item i1; product i2; i2.setData(3,4); i1=i2;// i1=i2.operator int(); just to revise i1.showData(); } Is it correct sir, for casting operator. or should i have to use member function to get the value of a and b in line no:4 and 5. Please help. Nahi to neend nahi ayegi sir. :) Regards.
sir, the line " i1=p1;" should call the implicit copy assignment operator created by compiler ,not the copy constructor but why it is calling copy constructor ? i have checked for same class object , it calls the assignment operator not copy constructor
Hello Sir! Sir in main function you've created object of Item type therefore making default constructor u made later to get executed but Sir then how is constructor Item(Product p) gets executed even though we haven't even pass any parameter of product type in its paranthesis or created any object like Item i2(Product p1) and in that case will writting this will be correct or not Product p1; Item(p1); ? Regards.
Here is an example which shows the type conversion from primitive to class, class to primitive and the two cases of class to class conversion. During class to class conversion using constructor the class whose object value is being copied should be placed above (unit class in the below example) and during the operator casting the class in whose object we want to copy data should be placed above (general class in the below example). Hope it helps. #include #include using namespace std; class unit{ int k; public: unit () { } // unit (general g) // using constructor class to class conversion // { k = g.geta(); } void setdata(int a) { k=a; } void showdata() { cout
Here it is: #include using namespace std; class Product { private: int pnum1; int pnum2; public: void setnumber(int px, int py) { pnum1= px; pnum2 = py; } void display() { cout
Sir agar ham isme ek aur object bnae jo ek int argument le rha h aur uske liye constructor bnae to vo error de rha h sayad x=c1 us constructor ko bhi call kar rha h usi time jis time vo oprator ko call kar rha h
Nice.. Sir... Pls upload class to class type conversation using casting operator... We r getting error as private variable unable to access also upload vedeo for access private variable using friends... If possible
Prasang S... If use public then no need of privet... May b possible other way to describe using casting operator type... Sirji upload this video and show new path to us....
dnt make the variables public... instead jst use functions to Set values to member variables.... U can call those functions from Casting fun. and pass the values
its so fun to study from Saurabh Sir, Sir you're doing great ! coding seems like exploring !
Sir, this is what I have coded for class to class type conversion using casting operator.. please, check it once... however output is correct I have done using code blocks
# include
using namespace std;
class item
{
private :
int m,n;
public:
void setm(int x)
{m=x;}
void setn(int y)
{n=y;}
void showdata()
{cout
Thank u bhai
operator item()
{
item i1;
i1.setData(a,b);
return i1;
}
Thanks a lot Man !!!
You should edit this command and add space between some lines for better understanding
Sir aap bahut galat kaam kar rahe hai. Itna achha mat padhaiye. Hame sirf aapke video hi samajh aate hai. agar kisi topic par aapka video nahi bana hai to samajhane me bahut takleef hoti hai. Seriously BEST COACH I ever seen in my life. Keep it up.
I'm very thankful to you, I learned a lot from your videos. Can you please make 1 video for Dynamic casting..
Thankyou sir your explanation is unique and awesome !! I think U are the one of the most good explainer sir really !! 👍
Thank you very much. You are a genius.
Use of Casting Operator.
#include
#include
#include
using namespace std;
class item
{
private:
int a,b;
public:
void setData(int x,int y){
a=x; b=y;
}
void showData(){
cout
How can you call set(m) by items object
@@easylife2482 In this code are not able to only set(m) but you can do make some changes in gater and seter.
Suryapratap singh you have infinite knowledge. You are brilliant genius God father of Albert einstein
Very nice lecture line by line ploblem solve coding through thanku sir g
great video !
Sir, product data members can be accessed within a function (and also a constructor) if an object of that class is passed as an argument to that function..so, here it would have worked without getM() function.
graet explation sir_____thank you
i am very thankuful to u sir,ur teaching style is too good
sir please make a video on static and dynamic casting, I am confused in early binding problem because of these topics.
We can use parameterized constructor of item class to perform operator casting.
i1 = p1; // p1.operator Item();
In Product class
operator Item()
{
Item temp(m,n);
return(temp);
}
Thankyou so much sir.
I was thinking about how we can do it by making the whole class as Friend Function and then accessing member variables through dot format, but in this case we need to have Arguments of that class which is not possible in Casting Operator.
Thank you sir for such a wonderful lecture.... 😊😊😊
thank you very much...all of your helped a lot sir...thanks
i hope more videos about the programming language will be added in the future
sir make a video on casting operator also
By Casting operator for reference .
#include
using namespace std;
class product;
class Item
{
int a,b;
public:
Item()
{}
void PutA(int a)
{
this->a = a;
}
void PutB(int b)
{
this->b = b;
}
friend void show(Item ,product );
};
class product
{
int a,b;
public :
product()
{
cin>>a;
cin>>b;
}
operator Item()
{
Item I;
I.PutA(a) ;
I.PutB(b);
return I;
}
friend void show(Item ,product );
};
void show(Item I,product P)
{
cout
thanks bro your code is useful for me.....
please upload the video of clas to class conversion using casting operator
#include
using namespace std;
class item
{
int m,n;
public:
item(){
}
item( int a,int b)
{
m=a;
n=b;
}
void show()
{
cout
@@pratikpandey3651 Brother Can you explain your code? It's urgent
We can use friend function to get values of m and n
We can also inherit the product class in the item class
Awesome Lecture 👍
Thank you sir 🙏
thanks sir for the amazing explanation
please make video on class to class conversion using casting operator
we can eliminate default const. error using item i1 = p1 in the fiirst line itself rather than assigning it explicitly.
what a pleasure to learn from you!!!!!
Perfection
humne constructor main Product ka hi object bna diya h sir isme hmen Product ka refernce varible nai bnaaa skte the kya aesa krne pr ek constructor or bn jayega
Sir, product class ke members ko access karne ke liye item class me friend function bana sakte hai kya.....?
Humlog constructor ko hi friend function bana sakte hai product class ke liye.
Ref. Lecture 12 part 6
haa bro hojata he
mera success hogaya
Your Explanations are great sir.
best explanation thank u sir
Plz sir i requeste you send me CLASS TO BASIC and BASIC TO CLASS TYPE CONVERSION program with exaplanation....
thank you sir
We could declare item class a friend of product class so that we can access the private member of product class in item class...
Another approach could be we can make item constructor a friend of product class.
Thanks sir i easily understand
Thank you sir,good explanation 😊
Please make a video on casting operator also
Sir jo product main 'p' likha h wo khi declare to kya nhi or main m p1 declare h instead of p.
+Vineet Singh Product p1; It means p1 is an object of class Product. yeh main mein declare kiya hai. p kahin bhi nahi likha hai, sabhi jagah p1 hai. Fir bhi agar kahin meine dekh nahi pa raha hun to please batayein. Thanks for watching
void showData()
{ cout
Vineet Singh p is argument of constructor product, it is not p1 object. so you should not confuse about this.
Sir casting operators kya hote h and how they are different from type conversion please explain through videos .
Thank you;
Thank you sir. you are just great.
operator item ( )
{
item temp;
temp.a=i2.m;// i think i am doing sth wrong here ?
temp.b=i2.n;
return(temp);
}
now in main()
{
item i1;
product i2;
i2.setData(3,4);
i1=i2;// i1=i2.operator int(); just to revise
i1.showData();
}
Is it correct sir, for casting operator.
or should i have to use member function to get the value of a and b in line no:4 and 5. Please help. Nahi to neend nahi ayegi sir. :)
Regards.
You didn't sleep for a year?🧐
#include
#include
using namespace std;
class item
{
int a,b;
public:
void showdata()
{
cout
plz also upload video using casting method
sir, the line " i1=p1;" should call the implicit copy assignment operator created by compiler ,not the copy constructor but why it is calling copy constructor ?
i have checked for same class object , it calls the assignment operator not copy constructor
World class explanation
And how can u do this, really wonderful
Sir please make a video on casting operator also, its a humble request sir
#include
using namespace std;
class jaa;
class mayu
{
int a,b;
public:
mayu(){}
void setdata(int a,int b)
{
this->a=a;
this->b=b;
}
void showdata(void)
{
cout
#include
using namespace std;
class item
{
int a,b;
public:
// item(){}
// item(product &ob){a=ob.getm();b=ob.getn(); }
void set(int x,int y)
{
a=x;b=y;
}
void show()
{
cout
Hello Sir! Sir in main function you've created object of Item type therefore making default constructor u made later to get executed but Sir then how is constructor Item(Product p) gets executed even though we haven't even pass any parameter of product type in its paranthesis or created any object like Item i2(Product p1) and in that case will writting this will be correct or not Product p1; Item(p1); ?
Regards.
Why we are not passing the reference of Product object ? It should ideally get into trap of creating object of Product class each time ?
sir please, casting operator wali video or upload kar do
Here is an example which shows the type conversion from primitive to class, class to primitive and the two cases of class to class conversion.
During class to class conversion using constructor the class whose object value is being copied should be placed above (unit class in the below example) and during the operator casting the class in whose object we want to copy data should be placed above (general class in the below example). Hope it helps.
#include
#include
using namespace std;
class unit{
int k;
public:
unit () { }
// unit (general g) // using constructor class to class conversion
// { k = g.geta(); }
void setdata(int a)
{ k=a; }
void showdata()
{ cout
#include
#include
using namespace std;
class item
{
int a,b;
public:
void showdata()
{
cout
@@ayeshasiddiqua1037 Amaze......
@@PramodYadav-il2gk u r insane Super
@@PramodYadav-il2gk bro ye program mene compile karke dekha run nahi ho raha .... proper solution aap muje bata sakte haii?????plzz
You are excellent sir
But what about casting operator
Sir here we passing object as argument to constructor sir, than why you do not make copy constructor sir.pls explain sir
Sir.. Casting Operation me ..Private member ko value dene k liye access kaise kare??
same problem bro
Nice explanation
Awesome
Well explained!😃✌🏻
this task can also be done using friend function
exactly....
also frnd function is easy
Sir please show a vedio of casting operator of example shown in the same vedio
Jb I1=P1 krenge तो dono check hoga kya sir.... ki conversion constructor ke through krna h ya casting operator ke.... kaunsa pahle check hoga
Sir u didn't posted a video on th class to class type by casting operator or type conversion operator.. plz put a video on this..req
Sir what i have to do in which task of
Typeconversion of 2 classes are asked simultaneously?
sir,please upload RTTI videos and dynamic casting videos sir,please....
I need ur book or DVD😊 because in my rural area there is problem in internet source😢 so plz help me😮
Sir please add video of conversion using casting operator...
Here it is:
#include
using namespace std;
class Product
{
private:
int pnum1;
int pnum2;
public:
void setnumber(int px, int py)
{ pnum1= px; pnum2 = py; }
void display()
{ cout
Sir please make video for casting operator
Sir agar ham isme ek aur object bnae jo ek int argument le rha h aur uske liye constructor bnae to vo error de rha h sayad x=c1 us constructor ko bhi call kar rha h usi time jis time vo oprator ko call kar rha h
Using casting operator
operator Item() {
Item i(m,n);
return i;
}
Sir, please make this video with Casting operator, plsssssss sir
please upload class to class conversion using casting operator
Sir m or n varible or product class m public mh kr skte lya to getm or getn function bnane k bjh
phir koi bhi akpe data ko change ker sakta hai isliye private rakhate hai
Sir you are great.
Sir explicit constructor kya hota hai?
Sir please upload an video on operator casting please!!!
thanks for help MysirG
Fantastic video Sir
U r great
Nice.. Sir...
Pls upload class to class type conversation using casting operator... We r getting error as private variable unable to access also upload vedeo for access private variable using friends... If possible
mehul prajapati make it public...we don't have any other option...
Prasang S... If use public then no need of privet... May b possible other way to describe using casting operator type... Sirji upload this video and show new path to us....
My teacher shared a program with me.... in that it was public....so I thought it's necessary to use public instead of private...
dnt make the variables public... instead jst use functions to Set values to member variables.... U can call those functions from Casting fun. and pass the values
@@debashishdas2514 Thanks, brother!
Nice
god level sir
so it means ke ek object ke sath dono constructor call ho rahe hai?
Here why reference of p is not used in the constructor?????
sir can we declare constructor of 1 class as friend function to another class.
is bro it is possible
Superb
sir casting operator wala method mai kya likha jaega bata dijiye error aa raha hai.Thank you sir you r doing a gr8 job.
conversion from one class type to another by casting function
How to do that
Thank you sir
sir how to compare two strings of the same class usin '=='operator overloading
sir please give me reply as early as possible
instead of using getM() and getN() we can me class item friend class of class product
Thanks
Sir,if I declare two constructors in item class so I declare default constructor or not??
yes,u hv to declare default constructor whenever you declare custom constructor
Thanks a lot
sir wo m n ko private ki jagah protected bhi toh ker skte hai na?
thank u soo much sir
operator item()
{
item i1;
i1.setData(a,b);
return i1;
}
Solution using casting operator :
#include
using namespace std;
class Item{
private:
int a,b;
public:
void showData(){
cout
can we use friend class concept ???
can we use template to convert any type.
how to solve problem if variables is not in both class ??
scroll slowly kijiye taki coding notedown kar sake
Ab to chhap gya hai deemag me
Jab bhi hum Koi constructor bna dete hai class me to compiler default constructor nhi banata
sir wo parenthesis wala error code blocks me bhi aata hai.. uska reason batao sir
Can we use friend function here