16 lines
257 B
TypeScript
16 lines
257 B
TypeScript
// rabbit.ts
|
|
|
|
class Rabbit {
|
|
name: string;
|
|
|
|
constructor(name: string) {
|
|
this.name = name;
|
|
}
|
|
}
|
|
|
|
let myName: string = "Monty";
|
|
let r: Rabbit = new Rabbit("Python");
|
|
|
|
console.log(r.name); // ERROR!!!
|
|
console.log(myName); // Prints "Python"
|