Answer the question
In order to leave comments, you need to log in
Private method in interface (typescript) is it possible?
Is it possible to create an interface with a private method:
interface I_Main {
readonly RUNNING_SPEED: number;
private getHeight():void;
}
private getHeight():void;
Answer the question
In order to leave comments, you need to log in
Interfaces define "Public" properties and methods and have no meaning from an access modifier like protected or privat
You can do something like:
interface IModuleMenuItem {
getName(): string;
}
class ModuleMenuItem implements IModuleMenuItem {
private name;
public getName() {
return name;
}
protected setName(newName : string) {
name = newName;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question