Skip to content

Commit

Permalink
13 OOP > Object > Inheritance > add
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMadWill committed Dec 7, 2021
1 parent 4c97674 commit 2f9c15b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 3 deletions.
36 changes: 34 additions & 2 deletions 13_Object_Oriented_Programming/Js/43_13_1_Object.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,44 @@ class Student{
}

let student2=new Student("15b","Sakura",15); // instance
console.log(student2)
console.log(student2.BirthYear())
// console.log(student2)
// console.log(student2.BirthYear())

//** Inheritance

class Person {
constructor(name,yearOfBirth,job){
this.name=name
this.yearOfBirth=yearOfBirth
this.job=job

this.CaculateAge=function(){
let date =new Date
return date.getFullYear() - this.yearOfBirth
}
}
}


Person.prototype.GetName=function(){
return this.name
}

Person.prototype.lastName="Domation of Road"



let mad = new Person("Mad",15,"Developer")
let will = new Person("Will",21,"Wayer")


console.log(mad)
console.log(mad.lastName)
console.log(mad.CaculateAge())

console.log("*********************")

console.log(will)
console.log(will.lastName)
console.log(will.GetName())

1 change: 1 addition & 0 deletions 3_Methods/JavaScripts/5_3_1_DateTimeMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

let dtA=new Date('1/1/1990');


let getOfDate=dtA.getDate();

dtA.setDate(getOfDate-1)
Expand Down
8 changes: 8 additions & 0 deletions Documantation/13_Object_Oriented/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,11 @@
## (Funcition)Constractor C# daki classlarla eyni anlayşdır.
> Yaradcağımız obeyktlərin qəlibidir.

## Inheritance
> Bir Parent obyektində yaradılacaq obyektlərin əsas xususiyyətlərini yığaraq Child obyektləri ondan törədirik.
### Prototype
> Hər bir obyektin `prototype`ı olur və əgər biz hər hası bir obyektin yardılmasında `class`dan istifadə edəriksə bu zaman həmin obyektin xususiyyətlərni kopyalayır ancaq `prototype`dan istfadə edəriksə onda parent obyektin xususiyyətlərindən istfadə edir ancaq özünə kopyalamır bu yaddaşda az yer tutur.
- `prototype` yazılan dəyərlər sabitdir
- Əsasən hər obyektə aid ümümi xususiyyətləri `prototype` da tutulur.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,6 @@
- [Form Validation](https://github.com/DrMadWill/JavaScript/blob/main/12_JQery/42_12_11_Form_Validation.html)

### Object Oriented Programming
- Object and Constroctor
- [Object and Constroctor](https://github.com/DrMadWill/JavaScript/blob/main/13_Object_Oriented_Programming/Js/43_13_1_Object.js)
- [My Documantation](https://github.com/DrMadWill/JavaScript/blob/main/Documantation/13_Object_Oriented/documentation.md#object-oriented-programming)
- Inheritance

0 comments on commit 2f9c15b

Please sign in to comment.