Re[2]: Это только мне не хватает?
От: adontz Грузия http://adontz.wordpress.com/
Дата: 03.08.05 09:51
Оценка:
Здравствуйте, Сергей Губанов, Вы писали:

СГ>А что мешает писать так:


Там не всё так просто. класс B в свою осередь реализует другие не мои интерфейсы. Если по-подробнее то так
interface IOwfulInmterface
{
  int MethodWithOwfulSignature(owful_parameters)
}

class VeryGoodClass1
{
 public:
  int MethodWithUnderstandableParameters(understandable_parameters);
}

class VeryGoodClass2
{
 public:
  int MethodWithUnderstandableParameters(understandable_parameters);
}

class VeryGoodClass3
{
 public:
  int MethodWithUnderstandableParameters(understandable_parameters);
}

template <typename T>
class Proxy : public T, public IOwfulInterface
{
 public:
  int MethodWithOwfulSignature(owful_parameters)
  {
    MethodWithUnderstandableParameters(understandable_parameters);
  }
}

и соответсвенно
interface IOwfulInterface
{
  int MethodWithOwfulSignature(owful_parameters);
}

interface IVeryGood
{
  int MethodWithUnderstandableParameters(understandable_parameters);
}

public class VeryGoodBase : IOwfulInterface
{
  public int MethodWithOwfulSignature()
  {
    ((IVeryGood)this).MethodWithUnderstandableParameters(understandable_parameters);
  }
}

public class VeryGood1 : VeryGoodBase, IVeryGood
{
  public int MethodWithUnderstandableParameters(understandable_parameters);
}

public class VeryGood2 : VeryGoodBase, IVeryGood
{
  public int MethodWithUnderstandableParameters(understandable_parameters);
}

public class VeryGood3 : VeryGoodBase, IVeryGood
{
  public int MethodWithUnderstandableParameters(understandable_parameters);
}

Внутри Proxy/VeryGoodBase::MethodWithOwfulSignature очень много общей логики.
То что ты написал это тоже хорошо, но интерфесов IVeryGood на самом деле несколько и не все их них всегда реализуются.
К тому же основная проблема для меня в том, что все проверки уходят в run-time и я понятия не имею реализовал ли класс-потомок всё что от него хотел базовый класс пока сам это ручками не проверю или пока не прогоняю тест, а он обширный и это просто неудобно.
A journey of a thousand miles must begin with a single step © Lau Tsu
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.