Наследование
От: Foror http://foror.ru
Дата: 22.04.06 06:47
Оценка:
Есть следующее:

class Producer {}
class Author extends Producer {}
class MusicAuthor extends Author {}

Теперь для каждого из этих классов нужны классы с операциями: add, delete, get, update

interface IProducerOperations {
void add(Producer producer);
Producer get(int id);
void delete(int id);
void update(Producer producer);
}

class ProducerOperations implements IProducerOperations {}

Дальше мне необходиомо для каждого доменного объекта Author, MusicAuthor создать
свой интерфейс и реализацию, при этом чтобы в методах add, get, update были
обозначены отличные от Producer типы, а именно Author или MusicAuthor.

Я хочу просто взять и сделать следующее:

interface IAuthorOperations extends IProducerOperations {
void add(Author author);
Author get(int id);
void update(Author author);
}

class AuthorOperations implements IAuthorOperations {}

interface IMusicAuthorOperations extends IAuthorOperations {
void add(MusicAuthor author);
MusicAuthor get(int id);
void update(MusicAuthor author);
}

class MusicAuthorOperations implements IMusicAuthorOperations {}

Но что-то я не уверен в правильности такого решения...
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.