class Father {
name: string = 'A';
age: number = 18;
skills: string[] = ['B', 'C', 'D', 'E', 'F'];
constructor(name: string, age: number, skills: string[]) {
this.name = name;
this.age = age;
this.skills = skills;
}
show(): string {
return `I am ${this.name},${this.age} years old, having skills in ${this.skills}`;
}
}
class Child extends Father {
role_no: number;
subject: string;
constructor(
name: string,
age: number,
skills: string[],
roleNo: number,
subject: string
) {
super(name, age, skills);
this.role_no = roleNo;
this.subject = subject;
}
show(): string {
return `${super.show()} and roll number is : ${
this.role_no
} my faourite subjects : ${this.subject}`;
}
}
type Data5 = {
name: string;
age: number;
skills: string[];
roleNo: number;
subject: string;
};
const details: Data5 = {
name: 'Raman',
age: 45,
skills: ['React-Native', 'Web', 'Mobile', 'Azure'],
roleNo: 1240,
subject: 'Math',
};
const obj = new Father('Saten', 36, ['React', 'Web', 'Mobile', 'DevOps']);
const obj1 = new User(
'Pratap',
33,
['Typescript', 'Web', 'Mobile', 'DevOps'],
450,
'Mathmetics'
);
console.log(obj1.show());