Skip to content

Commit 030cbe5

Browse files
committed
Fix abstract class check
1 parent 002b164 commit 030cbe5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎JavaScript/1-file-storage.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const readline = require('readline');
88
class DataAccessLayer {
99
constructor() {
1010
const proto = Object.getPrototypeOf(this);
11-
if (proto === DataAccessLayer) {
11+
if (proto.constructor === DataAccessLayer) {
1212
throw new Error('Abstract class should not be instanciated');
1313
}
1414
}
@@ -27,7 +27,7 @@ class DataAccessLayer {
2727
class Database {
2828
constructor(dal) {
2929
const proto = Object.getPrototypeOf(this);
30-
if (proto === Database) {
30+
if (proto.constructor === Database) {
3131
throw new Error('Abstract class should not be instanciated');
3232
}
3333
this.dal = dal;
@@ -41,7 +41,7 @@ class Database {
4141
class Cursor {
4242
constructor(dal) {
4343
const proto = Object.getPrototypeOf(this);
44-
if (proto === Cursor) {
44+
if (proto.constructor === Cursor) {
4545
throw new Error('Abstract class should not be instanciated');
4646
}
4747
this.dal = dal;

0 commit comments

Comments
 (0)