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