lovelock გინდა ელემენტარულ დონეზე აგიხსნა?

12-8
Add the unary operator- to Exercise 2 and demonstrate that it works correctly.
Solution:
This solution covers exercises 2-6 as well. Here is a class that has all the operators called for. First, the header file:
//: S12:HasInt.h
#ifndef HASINT_H
#define HASINT_H
#include
class HasInt {
int n;
public:
HasInt(int i = 0);
HasInt& operator++();
const HasInt operator++(int);
HasInt& operator--();
const HasInt operator--(int);
HasInt operator-() const;
HasInt& operator+=(const HasInt&);
HasInt& operator-=(const HasInt&);
// Global Friends:
friend std::ostream& operator
This post has been edited by Nimrodel on 21 Oct 2020, 02:20