-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPG Saga by Kirill Bokov #26
Conversation
…тично сделаны codewars. RPG Saga пока не готова.
rpgsaga/computer/src/main.ts
Outdated
constructor(deviceName: string, device_energy_consumption : number) { | ||
this._name = deviceName; | ||
this.energy_consumption = device_energy_consumption; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
получается можно поставить отрицательные значения на потребление энергии
rpgsaga/computer/src/main.ts
Outdated
print_name(): void { | ||
console.log(`Имя: ${this._name}`); | ||
} | ||
public get name(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не указан тип возвращаемого значения
public get name(){ | ||
return this._name | ||
} | ||
public set name(input : string){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше указать void в качестве типа возвращаемого значения
rpgsaga/computer/src/main.ts
Outdated
this._memory = memory; | ||
this.data_transfer_time_sec = data_transfer_time_sec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут тоже могу сделать отрицательными
rpgsaga/computer/src/main.ts
Outdated
data_transfer_time_sec : number; | ||
constructor(deviceName : string, memory : number, data_transfer_time_sec : number, device_energy_consumption : number) { | ||
super(deviceName, device_energy_consumption); | ||
this._memory = memory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this._memory = memory; | |
this.memory = memory; | |
Это приведет к вызову сеттера с соответствующей проверкой
rpgsaga/computer/src/main.ts
Outdated
this._memory = input; | ||
} else { | ||
this._memory = 0; | ||
console.log("Ошибка при вводе памяти!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
бросайте тут эксепшен
rpgsaga/computer/src/main.ts
Outdated
let pc = new HDD("Toshiba", 1024, 512, 400); | ||
console.log(pc.memory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не надо в самом файле определять поля + const pc = ...
import { HDD } from '../src/main'; | ||
describe("Testing Computer", () => { | ||
it('Test to check the test operation', () => { | ||
expect(Math.max(1, 5, 10)).toBe(10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавить тесты на отрицательные значения
rpgsaga/saga/src/index.js
Outdated
@@ -0,0 +1,18 @@ | |||
function randElement(arr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а почему js?
rpgsaga/saga/src/index.ts
Outdated
@@ -1,16 +1,20 @@ | |||
import { Phone } from './phone'; | |||
function randElement(arr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
вот тут нет еще 1 задания из полиморфизма
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
задание на создание списка (с указанием типа списка) и вызова абстрактного метода родительского класса в дочерних классах
… компонентов программы
Просто хочу показать, что работа идёт