Answer the question
In order to leave comments, you need to log in
How is the display list formed?
Yesterday asked the question Multiple inheritance does not violate OOP? , in which I was criticized, and today I have a different view on this issue and for this I decided to ask again.
Yesterday's question sounded like - can one class implement many interfaces that are not similar in behavior. Type -
interface INode {
next: INode
prev: INode
}
interface ITask {
execute(): void;
}
interface ISet {
insert(target: INode): void;
};
class SomeClass implements INode, ITask, ISet{
next: INode;
prev: INode;
execute():void {}
insert(target: INode):void
{
// и здесь просиходит установка таргета
this.next = target;
target.prev = this;
}
}
Answer the question
In order to leave comments, you need to log in
the question is a little strangely posed, it is not clear why in general in such a simple example to fence a bunch of interfaces if all this is solved elementarily:
class SomeClass
{
public SomeClass parent;
public SomeClass child;
void execute{
}
void insert(SomeClass target)
{
this.child = target;
target.parent = this;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question