zielo icon

Untitled

zielo | PRO | 04/10/18 08:40:54 PM UTC | 0 ⭐ | 687 👁️ | Never ⏰ | []
C++ |

520 B

|

None

|

0 👍

/

0 👎

#include <iostream>
#include <memory>
using namespace std;
 
class complex_base
{
  float re, im;
public:
  float real()
  {
    return re;
  }
  void real(float rr)
  {
    re=rr;
  }
  float img()
  {
    return im;
  }
  void img(float ii)
  {
    im=ii;
  }
  void print() const
  {
    cout << re << ",j" << im;
  }
};
int main()
{
  shared_ptr<complex_base> x(new complex_base);
  x->real(143);
  x->img(-24);
  shared_ptr<complex_base> y(new complex_base);
  y=x;
  y->print();
  return 1;
}

Comments