Now, we want to declare a PartyWithDeeJayProtocol
protocol and make the generic PartyWithDeeJay<T, K>
class conform to this new protocol. We will make this protocol inherit from the previously created PartyProtocol
that defined a MemberType
associated type. Thus, the PartyWithDeeJayProtocol
protocol will inherit this associated type. We have to specify another associated type that will be specified during the protocol implementation—that is, when we declare the class that conforms to the new protocol.
The following lines show the declaration of the PartyWithDeeJayProtocol
protocol that inherits from the PartyProtocol
protocol. We must declare the protocol before the public class PartyWithDeeJay<T: AnimalProtocol, K: DeeJayProtocol where T: Equatable>: Party<T>
line that starts the declaration of the Party<T, K>
class that we want to edit to make it conform to this new protocol:
public protocol PartyWithDeeJayProtocol...