Problem #1: Point out the errors(s) if any, in the following program:

``````
1     // Problem related to Operator
3     #include <iostream.h>
4
5     class myclass
6     {
7       int a;
8
9     public:
10      myclass(int);
11      void show();
12
13      myclass operator ++();
14      myclass operator --();
15    };
16
17    myclass::myclass(int x)
18    {
19      a=x;
20    }
21
22    void myclass::show()
23    {
24      cout<<a<<endl;
25    }
26
27    myclass myclass::operator ++()
28    {
29      a++;
30
31      return *this;
32    }
33
34    myclass myclass::operator --()
35    {
36      a--;
37
38      return *this;
39    }
40
41    // main
42    void main()
43    {
44      myclass ob(10);
45
46      ob.show();
47
48      ob++;
49      ob.show();
50    }

``````

Problem #2: Point out the errors(s) if any, in the following program:

``````
1     // Problem related to Operator
3     #include <iostream.h>
4
5     class myclass
6     {
7       int a;
8       int b;
9
10    public:
11      myclass(int, int);
12      void show();
13
14      myclass operator=(myclass);
15    };
16
17    myclass myclass::operator=(myclass ob)
18    {
19      a=ob.a;
20      b=ob.b;
21    };
22
23    myclass::myclass(int x,int y)
24    {
25      a=x;
26      b=y;
27    }
28
29    void myclass::show()
30    {
31      cout<<a<<endl<<b<<endl;
32    }
33
34    // main
35    void main()
36    {
37      myclass ob(10,11);
38      myclass ob2(20,21);
39      myclass ob3(30,41);
40
41      int x,y,z;
42
43      x=y=z=10;
44      cout<<z<<endl;
45
46      ob=ob2=ob3;
47      ob.show();
48    }

``````

Problem #3: Point out the errors(s) if any, in the following program:

``````
1     #include <iostream.h>
2
3     // class
4     class myclass
5     {
6       int a;
7
8     public:
9       myclass(int);
10      void show();
11
12      void operator ++();
13      void operator --();
14    };
15
16    myclass::myclass(int x)
17    {
18      a=x;
19    }
20
21    void myclass::show()
22    {
23      cout<<a<<endl;
24    }
25
26    void myclass::operator ++()
27    {
28        a++;
29    }
30
31    void myclass::operator --()
32    {
33      a--;
34    }
35
36    // main
37    void main()
38    {
39      myclass ob(10);
40      myclass ob2(100);
41
42      ob.show();
43      ob2.show();
44
45      ob2=++ob;
46      ob.show();
47      ob2.show();
48    }

``````

1. Although no error is reported (MS Visual C++) but line number 48 has a problem because postfix version of the operators have not been overloaded. This way the compile uses prefix form instead besides giving warning.

2. ERROR in line number 46. Here ob2=ob3 is first evaluated by the overloaded assignment operator as defined but it is not returning any value which can be further assigned to ob.

3. ERROR in line number 45. Operator function is not returning anything which can be assigned to ob2.

Related Articles:

### Fix For Toshiba Satellite "RTC Battery is Low" Error (with Pictures)

RTC Battery is Low Error on a Toshiba Satellite laptop "RTC Battery is Low..." An error message flashing while you try to boot your laptop is enough to panic many people. But worry not! "RTC Battery" stands for Real-Time Clock battery which almost all laptops and PCs have on their motherboard to power the clock and sometimes to also keep the CMOS settings from getting erased while the system is switched off.  It is not uncommon for these batteries to last for years before requiring a replacement as the clock consumes very less power. And contrary to what some people tell you - they are not rechargeable or getting charged while your computer or laptop is running. In this article, we'll learn everything about RTC batteries and how to fix the error on your Toshiba Satellite laptop. What is an RTC Battery? RTC or CMOS batteries are small coin-shaped lithium batteries with a 3-volts output. Most laptops use

### The Best Way(s) to Comment out PHP/HTML Code

PHP supports various styles of comments. Please check the following example: <?php // Single line comment code (); # Single line Comment code2 (); /* Multi Line comment code(); The code inside doesn't run */ // /* This doesn NOT start a multi-line comment block /* Multi line comment block The following line still ends the multi-line comment block //*/ The " # " comment style, though, is rarely used. Do note, in the example, that anything (even a multi-block comment /* ) after a " // " or " # " is a comment, and /* */ around any single-line comment overrides it. This information will come in handy when we learn about some neat tricks next. Comment out PHP Code Blocks Check the following code <?php //* Toggle line if ( 1 ) {      // } else {      // } //*/ //* Toggle line if ( 2 ) {      // } else {      // } //*/ Now see how easy it is to toggle a part of PHP code by just removing or adding a single " / " from th

### How to Remove Bullet Points in CSS

This will be a short guide on how to remove bullet points from ordered/unordered lists with CSS, you only need two lines of CSS for this. The first removes the actual bullet points and the second one removes the space to the left, as evident from the following video: We'll also be doing some bullet beautification in the last section if that's what you are looking to do. How to Remove Bullet Points in HTML/CSS Now that we know what CSS properties actually accomplish what we want let's see how we can implement this in our HTML code. Using Inline "style" Tag (The quick and dirty way) As the title suggests, this is the quickest way to remove bullet points in which you wouldn't have to edit any CSS files (for example, for Blogger or WordPress). This method would be useful for a one-off case - just add the following " style " attribute to the list you want to remove the bullet points from: <h1>Ordered List</h1> <ol  style="list-styl