Answer the question
In order to leave comments, you need to log in
Why can't access parent class method?
export interface IProfileStaff {
getName(): string;
}
export interface IProfilePupil {
getName(): string;
getOrganization(): void;
}
export class Organization {
protected getOrganization() {
return 'Organization name';
}
}
export class ProfileBase extends Organization { }
export class StaffProfile extends ProfileBase implements IProfileStaff {
public getName() {
return '';
}
}
export class PupilProfile extends ProfileBase implements IProfilePupil {
public getName() {
return '';
}
}
let a = new StaffProfile();
let b = new PupilProfile();
let arr: ProfileBase[] = [];
arr.push(a);
arr.push(b);
a.getOrganization(); // Здесь
Answer the question
In order to leave comments, you need to log in
Why can't I access the getOrganization method of the Organization class
public getOrganization() {
return super.getOrganization();
}
the ProfileBase class. Then the original will still be hidden in the Organization class, but available for calling from ProfileBase and ProfileBase descendants.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question