Conversion between classes

Posted by Nima on Stack Overflow See other posts from Stack Overflow or by Nima
Published on 2010-05-18T18:34:45Z Indexed on 2010/05/18 18:40 UTC
Read the original article Hit count: 334

Hi,

Let's say we have a class called A and another one called B. and we want to have a conversion method that converts A to B.

In the software architecture point of view, which one is preferred?

  1. write A.export()
  2. write B.import()
  3. write a converter class, i.e. convert(A, B) or Convert(A) or ...

if the language matters, I'm using C++

Thanks,

© Stack Overflow or respective owner

Related posts about c++

Related posts about software-engineering