-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
15062f9
commit 26acc05
Showing
1 changed file
with
23 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,46 @@ | ||
export class Cat { | ||
private age: number; | ||
private name: string; | ||
private breed: string; | ||
private theAge: number; | ||
private theName: string; | ||
private theBreed: string; | ||
private theWeight: number; | ||
|
||
constructor(age: number, name: string, breed: string) { | ||
this.age = age; | ||
this.name = name; | ||
this.breed = breed; | ||
constructor(age: number, name: string, breed: string, weight: number) { | ||
this.theAge = age; | ||
this.theName = name; | ||
this.theBreed = breed; | ||
this.theWeight = weight; | ||
} | ||
set Age(age: number){ | ||
this.age = age; | ||
this.theAge = age; | ||
} | ||
|
||
get Age(): number { | ||
return this.age; | ||
return this.theAge; | ||
} | ||
|
||
set Name(name: string){ | ||
this.name = name; | ||
this.theName = name; | ||
} | ||
|
||
get Name(): string { | ||
return this.name; | ||
return this.theName; | ||
} | ||
|
||
set Breed(breed: string){ | ||
this.breed = breed; | ||
this.theBreed = breed; | ||
} | ||
|
||
get Breed(): string { | ||
return this.breed; | ||
return this.theBreed; | ||
} | ||
set Weight(weight: number){ | ||
this.theWeight = weight; | ||
} | ||
|
||
get Weight(): number{ | ||
return this.theWeight; | ||
} | ||
getInfo(): string { | ||
return `Имя: ${this.name}; Порода: ${this.breed}; Возраст: ${this.age}.` | ||
return `Имя: ${this.theName}; Порода: ${this.theBreed}; Возраст: ${this.theAge}; Вес:${this.theWeight}.` | ||
} | ||
} |