05-Class-Inheritance.html
Dosyayı İndir
<html>
<head>
<script>
class Person{
constructor(firstName,lastName){
this.firstName=firstName;
this.lastName=lastName;
}
getFullName(){
return this.firstName+" "+this.lastName;
}
toString(){
return this.getFullName();
}
}
class Customer extends Person{
constructor(customerId,firstName,lastName,totalDebit){
super(firstName,lastName);
this.customerId=customerId;
this.totalDebit=totalDebit;
}
toString(){
return this.customerId+"-"+super.toString();
}
}
var customer=new Customer(301,"Orhan","Gencebay",2300);
console.log("Alıcı: "+customer.getFullName()+" Borç: "+customer.totalDebit);
console.log("Sicim: "+customer);
</script>
</head>
<body>
<h1> Kalıtım </h1>
</body>
</html>
Dosyayı İndir