as stated by others, there's no real point in using DTOs except if there's no transfer involved ... :)
the solution I'd propose, would be to abstract the object passed to Accountant
to an interface IAccountee
and have Person
implement it ... I'm not familiar with C# (from your profile, I infered that's your language of choice :) ), but this should probably point you to the right direction:
class Accountant {
//....
public void performAction(IAccountee target)
{
}
}
interface IAccountee
{
string Name
{
get;
}
int Salary
{
get;
set;
}
}
class Person : IAccountee
{
//implementation here, as well as some stuff specific to Person
}
basically, that's the D in SOLID :) ... it's flexible and clean and also avoids sharing unnecessary information from Person
with Accountant
...
as far as I understand, C# interfaces cannot require variables (as in most languages), which forces you to create accessors (unless there is some language/IDE feature to generate default plain accessors) if you haven't done so yet ... it's a little more time consuming than using plain variables, and requires more performance than a plain field access, but OTOH, it's also what I'd consider good practice, at least when things aren't getting performance ... I think it's definitely more elegant than creating an extra DTO-class and copying data back and forth (or at least in one direction) ...
hope that helps ... ;)