xxxxxxxxxx
interface MyInterface {
method1(): void;
method2(): string;
}
class MyClass implements MyInterface {
method1(): void {
console.log("Implementation of method1");
}
method2(): string {
return "Implementation of method2";
}
}
const myObject: MyInterface = new MyClass();
myObject.method1(); // Output: Implementation of method1
console.log(myObject.method2()); // Output: Implementation of method2