Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement