parent
d6774300aa
commit
7857f56201
@ -1,12 +1,11 @@
|
||||
/*var fs = require("fs")
|
||||
var vm = require('vm')
|
||||
// import { Card5 } from "../Model/Card5";
|
||||
// import('../Model/Card5');
|
||||
//import {Card} from '../Model/Card';
|
||||
|
||||
var content = fs.readFileSync(filename)
|
||||
vm.runInThisContext(content)
|
||||
*/
|
||||
console.log("~#Test#~");
|
||||
let card4 = new Card('red','2','losange','full');
|
||||
console.log(`carte de 4 elements : ${card4.color}`);
|
||||
let card5 = new Card5('blue','2','losange','full','pointillet');
|
||||
console.log(`carte de 5 elements : ${card5.outline}`);
|
||||
console.log(`carte de 5 elements : ${card5 instanceof Card5}`);
|
||||
console.log(`carte de 5 éléments instance de 5: ${card5 instanceof Card5}`);
|
||||
console.log(`carte de 5 éléments accès par méthode : ${card5.getAttributes()[0]}`);
|
||||
|
@ -1,9 +1,21 @@
|
||||
// import('.Card');
|
||||
|
||||
class Card5 extends Card {
|
||||
constructor(color, number, shape, filling, outline){
|
||||
super(color,number,shape,filling);
|
||||
this.outline=outline;
|
||||
}
|
||||
arrayOfAttributes(){
|
||||
|
||||
/**
|
||||
* @returns array of all attributes :
|
||||
idx 1 : color
|
||||
idx 2 : number
|
||||
idx 3 : shape
|
||||
idx 4 : filling
|
||||
idx 5 : outline
|
||||
* @author Bastien Jacquelin
|
||||
*/
|
||||
getAttributes(){
|
||||
return [this.color,this.number,this.shape,this.filling,this.outline];
|
||||
}
|
||||
}
|
||||
// export {Card5};
|
Loading…
Reference in new issue