Get premium membership and access questions with answers, video lessons as well as revision papers.
//overload the -- relative to coord class.
#include
using namespace std;
class coord {
int x, y; // coordinate values
public:
coord() {x=0; y=0;}
coord (int i, int j) {x=i; y=j;}
void get(int &i, int &j) {i=x}
coord operator--(int notused); //postfix
};
// Overload prefix -- for coord class.
coord coord::operator --()
{
x--;
y--;
return *this;
}
/erload postfix -- for coord class.
coord coord::operator--(int notused)
{
x--;
y--;
return *this;
}
int main()
{
coord o1(10, 10);
int x, y;
o1--;decrement an object
o1.get_xy(x, y);
cout << "(o1--) x: " << x << " y: " << y << "\n";
--o1; //decrement an object
o1.get_xy(x, y);
cout << "(--o1) x: << x << ", y: " << y << "\n";
return 0;
Githiari answered the question on June 8, 2018 at 18:35
- Overload the < and > operators relative to the coord class.
(Solved)
Overload the < and > operators relative to the coord class.
Date posted: June 8, 2018. Answers (1)
- Give the advantages of sequential files as a way of organizing files(Solved)
Give the advantages of sequential files as a way of organizing files
Date posted: June 7, 2018. Answers (1)
- Give the advantages of database-oriented approach as a way of organizing data(Solved)
Give the advantages of database-oriented approach as a way of organizing data
Date posted: June 7, 2018. Answers (1)
- State two standard methods for organizing data (Solved)
State two standard methods for organizing data
Date posted: June 7, 2018. Answers (1)
- Explain the main types of validation checks that may be used on data(Solved)
Explain the main types of validation checks that may be used on data
Date posted: June 7, 2018. Answers (1)
- Explain the factors determining the methods of data processing(Solved)
Explain the factors determining the methods of data processing
Date posted: June 7, 2018. Answers (1)
- Define a network(Solved)
Define a network
Date posted: June 7, 2018. Answers (1)
- Outline a typical sequence of actions carried out when an interrupt occurs in the central processing unit(Solved)
Outline a typical sequence of actions carried out when an interrupt occurs in the central processing unit
Date posted: June 7, 2018. Answers (1)
- Explain the types of interrupts in a computer(Solved)
Explain the types of interrupts in a computer
Date posted: June 7, 2018. Answers (1)
- Explain the operations provided by an operating system (Solved)
Explain the operations provided by an operating system
Date posted: June 7, 2018. Answers (1)
- What are the disadvantages of computers(Solved)
What are the disadvantages of computers
Date posted: June 7, 2018. Answers (1)
- Explain the types of system software(Solved)
Explain the types of system software
Date posted: June 6, 2018. Answers (1)
- What are the requirements of Multi-programming System?(Solved)
What are the requirements of Multi-programming System?
Date posted: June 6, 2018. Answers (1)
- What is multiprocessing?(Solved)
What is multiprocessing?
Date posted: June 6, 2018. Answers (1)
- What is a virtual Memory?(Solved)
What is a virtual Memory?
Date posted: June 6, 2018. Answers (1)
- What are the advantages of off-the-shelf software as a way of acquiring software(Solved)
What are the advantages of off-the-shelf software as a way of acquiring software
Date posted: June 6, 2018. Answers (1)
- What are the advantages of customized software?(Solved)
What are the advantages of customized software?
Date posted: June 6, 2018. Answers (1)
- What is the difference between a mouse and a trackball?(Solved)
What is the difference between a mouse and a trackball?
Date posted: June 6, 2018. Answers (1)
- What is a video conference?(Solved)
What is a video conference?
Date posted: June 6, 2018. Answers (1)
- Describe the machine cycle for every instruction in the central processing unit(Solved)
Describe the machine cycle for every instruction in the central processing unit
Date posted: June 6, 2018. Answers (1)