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
@gloryofgames16075 жыл бұрын
//I get error #include using namespace std; class Abc { public: int a; ABC() { a=0; } void input() { couta; } void show() { cout
@4.otechnologysaikumar8294 жыл бұрын
@@gloryofgames1607 me to broo...I have also error...
@ahadsun11884 жыл бұрын
i have never seen any videos with this much details,hats off you Sir.....Respect 1000
@stockmarket_matrix6 жыл бұрын
The given example is post increment so the below is the way to write it: #include using namespace std; class test int a; public: { test() { a=20; } void operator++() { ++a; } void operator--() { --a; } void operator++(int ) { a++; } void operator--(int ) { a--; } void show() { cout
@whoisnegii5 жыл бұрын
please explain why it has to be done like that ?
@sunnyjain6305 жыл бұрын
Thank you!
@lemonpooh17645 жыл бұрын
thank you so much
@shashankgupta67003 жыл бұрын
Sir you are the best .....I have seen so many videos of opeator overloading but did not get the concept and then i watched your video all concepts are clear.Thank you so much sir
@yuvrajsharma21344 жыл бұрын
Your teaching and content is very good. Really feels good to be on your channel.
@codingwithmx5 жыл бұрын
It was two errors in this code: you need to correct: void operator ++ (int){a++;} and void operator -- (int){a--;} because the unary operator has only one implicit and it also an integer.
@JohnDoe-ej6vm5 жыл бұрын
thanks a lot . but plz exmplain why we face error , and how parameter is working in this function ?
@shrishojha64904 жыл бұрын
thanks , what sir is doing would be right if he would have been using pre increment operator
@troopIine4 жыл бұрын
correct that's right
@HarishKumarC0074 жыл бұрын
Wonderful, thanks a lot
@ekambaramsainikhil93013 жыл бұрын
we need to call the function as operator objectname eg: ++t where ++ is the operator and t is the object name
@ajaykharat86896 жыл бұрын
Generally operators are designed to work with pre-defined datatype. In order to use operator with user-defined datatype operator are overloaded. In operator overloading:- a. With Binary operator 2 objects are required(one implicit and other explicit) b. with Unary operator 1 object is required(one implicit on LHS) void operator ++() { a++; cout
@arjumandayoub8483 Жыл бұрын
the reason for error can be explained as : The code you provided contains a compilation error because the `++` operator is overloaded as a prefix operator, but it is being used as a postfix operator in the `main` function. In C++, the `++` operator can be overloaded as both a prefix and a postfix operator. The prefix version of the `++` operator is declared by defining a member function with the signature `void operator++()`, while the postfix version is declared by defining a member function with the signature `void operator++(int)`. In your code, you have defined the prefix version of the `++` operator by declaring the member function `void operator++()`. However, in the `main` function, you are using the `++` operator as a postfix operator when you write `t++;`. This causes a compilation error because there is no matching overload for the postfix version of the `++` operator. To fix this error, you can either change the usage of the `++` operator in the `main` function to use it as a prefix operator (`++t;`) or define an overload for the postfix version of the `++` operator in your class. Is there anything else you would like to know?
@iniyaviji2796 Жыл бұрын
Lovely sir thank u so much
@jaypatel93924 жыл бұрын
Thank u sir for providing your valuable knowledge ❤️
@tayyabshahzad27473 жыл бұрын
you are a good instructor. t++ //Error because compiler treat it as binary operator. if one wants to run this , he/she must use it as binary operator. #include using namespace std; class fun{ public: int a; fun(int x):a(x) {} void operator - (int i) { a=a + i; cout
@darshkatare88968 ай бұрын
sir I scored good marks in practical exam because of you love u sir❤❤❤❤
@lincycarolinesagayam67264 жыл бұрын
It makes us feel easy
@sushantgupta47574 жыл бұрын
Thanku so much sir 😍😍
@aishwarya28607 жыл бұрын
Excellent sir
@bs_it49753 жыл бұрын
Thanks sir!
@gopialavala86182 жыл бұрын
sir in the place of a=0, with out using the zero it can be treated as the zero initial value
@harshavardhantp83084 жыл бұрын
When we are defining the constructor. Do we have to define default constructor or will it define itself
@arslanbegmyradov30484 жыл бұрын
whithout ERROR - Program should be: class Sample { int a; public: Sample() { //default constructor a = 0; } void operator++() { a++; // implicit } void operator--() { a- -; // implicit } void printValue() { cout
@rambhaktuchihaobito79872 жыл бұрын
Thank you bro
@mohitsaud20714 жыл бұрын
//Actually the program for the post fix is // #include using namespace std; class Test { int a; public: Test() { a=0; } Test( int n) { a=n; } void operator ++(int) { a++; } void operator --(int) { a--; } void show() { cout
@ernisrisatyavennela35234 жыл бұрын
can't we use pre increment operator for overloading?????
@dharmadevi98177 жыл бұрын
pls upload all java concepts.rly nice class
@vaishnavidubeyit_03096 жыл бұрын
Sir in unary operator if we have to increment & decrement in two different values means suppose a++ & b-- so how we can use it .
@al-hadees62363 жыл бұрын
there is small mistake in void main instead of t++ and t-- the correct way is ++t and --t
@ashishmishra-yu1jr4 жыл бұрын
Sir here pre increment and pre decrement work not post increment/decrement
@unknownchannel19243 жыл бұрын
just change a++ to ++a and a-- to --a similarly for t also.
@shubhampandey10734 жыл бұрын
sir can we overload the += operator or not
@amitkumargupta67224 жыл бұрын
here is the code for this program..... #include using namespace std; class test { int a; public: test() { a=0; } void operator ++ (int) { ++a; } void operator -- (int) { --a; } void show() { cout
@4.otechnologysaikumar8294 жыл бұрын
Here postfix oparator using to become error sir......then output become when the prefix oparating using.........whyyy this happend sirr
@rakshith34587 жыл бұрын
Can we refine "+" operator to subtract two operands instead of addition using operator overloading ?
@milindmodi47627 жыл бұрын
yes you can but only with user define data types.
@AryanRaj-gm6pu5 жыл бұрын
yes you can do
@viswanathgupta74067 жыл бұрын
load sessions on function overload sir
@rahmanullahshirzad78654 жыл бұрын
sir this is towice run but error what is problem?
@shubhampandey10734 жыл бұрын
sir this programme show an error in ide
@HarishKumarC0074 жыл бұрын
So in comment section, they have changed please go once, even I faced same thing
@ravikishore17436 жыл бұрын
Why & is present in the declaration of the Operator ++ overloading in the blow code sir? Complex &Complex::operator ++(){ } Please suggest. Also i saw some code where * is used instead of & like belo Complex *Complex::operator ++() { } Please explain.
@venkatp93814 жыл бұрын
& refers to reference, so a reference of class complex is the return type. If i t is *, it is pointer to class complex
@sumanthkavikondala10366 жыл бұрын
This code wont work, as you had overloaded the operator for prefix(pre-increment) and you were using postfix to call the overloaded function by ("t++") but instead "++t" would work. Where as postfix overloading is having a different syntax to do so by passing a dummy int as a argument. Sir please educate the correct information instead misleading the students. I understand that you are trying to educate students for free here but i feel its better not to teach at all instead of passing false information.
@gamuchiraimureyani2816 жыл бұрын
actually the misleading person is you
@sumanthkavikondala10366 жыл бұрын
A concept is a standard which cant be manipulated by any individual apart from the creator. Because of people like you students are getting wrong information and they carry the same to others.
@smarttube11416 жыл бұрын
Yeah Correct bro...
@adityadubey4086 жыл бұрын
yeah you are correct I found out the same error
@adityadubey4086 жыл бұрын
shut the f*** up !
@arjunmenonkandanat63283 жыл бұрын
what he is telling is wrong. This program will be of pre increment operator. NOT post increment operator in main() , he has to write ++t , instead of t++