zielo icon

4RL

zielo | PRO | 04/10/18 05:29:11 PM UTC | 0 ⭐ | 803 👁️ | Never ⏰ | []
C++ |

570 B

|

None

|

0 👍

/

0 👎

#include <iostream>
using namespace std;
 
class complex_base
{
    double a, b;
public:
    complex_base()
    {
        a=0;
        b=0;
    }
    complex_base(double a1, double b1)
    {
        a=a1;
        b=b1;
    }
    double real()
    {
        return a;
    }
    void real(double a)
    {
        this->a = a;
    }
    double imag()
    {
        return b;
    }
    void imag(double b)
    {
        this->b = b;
    }
    void print()
    {
        cout << a << ", j" << b;
    }
 
};
 
int main()
{
    complex_base X(7, -10);
    complex_base& Y = X;
    cout << "Wyswietlam X: ";
    X.print();
    cout << "\nWyswietlam Y: ";
    Y.print();
    return 0;
}

Comments