Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,57 @@
// Also give it a method "Speak", which says "Hello, My name is + name + and I'm + age + years old. I love + Hobby"


// Extend Person class and create one class for each member of your family.
// Extend Person class and create one class for each member of your family.

class Person {
consturctor (attributes) {
this.myName = attributes.myName;
this.age = attributes.age;
this.hobby = attributes.hobby;
this.properties = attributes.properties;

}

speak() {

return `hello ${this.myName} , and iam ,${this.age}, ${this.hobby} , ${this.properties}`

}

}

class child extends Person {
constructor(childAttributes){
super(childAttributes)
this.school = childAttributes.school;
}

}


const dad = new Person ({
myName: 'mohamed'
age : '35 years old'
hobby : 'sports'
properties: 'calm person'

})



const son = new child ({
myName: ' seraj'
age : '2 years'
hobby : 'soccer'
school : 'columbus toddler academy'


})

console,log(dad.speak())
console.log(son.speak())