Skip to content

Instantly share code, notes, and snippets.

@NGR-NP
Created November 12, 2022 15:50
Show Gist options
  • Save NGR-NP/83b55875c15300cd7a7ddc5e2d653ad2 to your computer and use it in GitHub Desktop.
Save NGR-NP/83b55875c15300cd7a7ddc5e2d653ad2 to your computer and use it in GitHub Desktop.
class Person {
hair_color;
blood_group;
gender;
constructor(hair_color, blood_group, gender) {
this.hair_color = hair_color;
this.blood_group = blood_group;
this.gender = gender;
};
};
class Man extends Person {
First_name = 'Tej';
Surname = 'Karki';
age = '22';
address = 'itahari';
Pet_Lover = true;
partner;
constructor(hair_color, blood_group, gender, First_name, Surname, age, address, Pet_Lover, partner) {
super(hair_color, blood_group, gender);
console.log(
`This Male has ${this.blood_group} Blood Group and His First Name is ${this.First_name} and Last Name is ${this.Surname}`
)
};
};
class Women extends Person {
First_name = 'senorita';
Surname;
age;
address;
Pet_Lover = true;
partner;
constructor(hair_color, blood_group, gender, First_name, Surname, age, address, Pet_Lover, partner) {
super(hair_color, blood_group, gender);
console.log(
`This Female has ${this.blood_group} Blood Group, Her First Name is ${this.First_name} and Last Name is ${this.Surname}`
);
};
};
const Man1 = new Man('Black', 'A+', 'male');
const Women1 = new Women('Sunflower Blonde', null, 'female');
console.table(Man1)
console.table(Women1);
console.warn('Reload your browser to view in table')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment