```typescript
// export default to import Dog from "Dog.js"
// without curly braces around Dog
export default class Dog extends Animal implements GravityInterface {
readonly name: string; // readonly vars
static #count = 0; // static vars
// NB: readonly: no setter for count (see getters and setters)
get count() {
return Foo.#count;
}
static { // static initialization code
try {
const lastInstances = loadLastInstances();
Foo.#count += lastInstances.length;
}
catch {}
}
// constructors and overloading (least specific first)
constructor();
constructor(theName?: string = "Lassy") {
this.name = theName;
super(); // super calls
}
// getters and setters
_weight = 0;
get weight() {
return this._weight;
}
set weight(value: number) {
this._weight = value;
}
// methods and visibility
// (private, protected, public [the default])
private bark(): string {
return this.name + "says WOOF";
}
}
```
## Class Reference
