class Greeter {
  public greeting: string;
  private _name: string;

  constructor(message: string) {
    this.greeting = message;
  }
  
  greet() {
    return this.greeting + ", " + this._name+"!";
  }
  
  get name(): string {
    return this._name;
  }

  set name(newName: string) {
    this._name = newName;
  }
}

let greeter = new Greeter("Witaj");
greeter.name="świecie";

alert(greeter.greet()); // Dane wyjściowe to "Witaj, świecie!".
