classes.ts 770 B

12345678910111213141516171819202122232425262728293031323334
  1. import {Author, Book, DamageLogger, Librarian} from './interfaces';
  2. class UniversityLibrarian implements Librarian {
  3. department: string;
  4. email: string;
  5. name: string;
  6. assistCustomer(custName: string): void {
  7. console.log(`${this.name} is assisting ${custName}.`);
  8. }
  9. }
  10. class ReferenceItem {
  11. static department = 'Research';
  12. private _publisher: string;
  13. constructor(public title: string, private year: number) {
  14. }
  15. printItem(): void {
  16. console.log(`${this.title} was published in ${this.year}`);
  17. console.log(`Department: ${ReferenceItem.department}.`);
  18. }
  19. get publisher(): string {
  20. return this._publisher.toUpperCase();
  21. }
  22. set publisher(p: string) {
  23. this._publisher = p;
  24. }
  25. }
  26. export { ReferenceItem, UniversityLibrarian };