diff --git a/Source/Console/test.js b/Source/Console/test.js index 95c4b82..8d750e4 100644 --- a/Source/Console/test.js +++ b/Source/Console/test.js @@ -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]}`); diff --git a/Source/Model/Card.js b/Source/Model/Card.js index fce0632..5b4aef9 100644 --- a/Source/Model/Card.js +++ b/Source/Model/Card.js @@ -5,5 +5,17 @@ class Card{ this.shape=shape; this.filling=filling; } + /** + * @returns array of all attributes : + idx 1 : color + idx 2 : number + idx 3 : shape + idx 4 : filling + idx 5 : null + * @author Bastien Jacquelin + */ + getAttributes(){ + return [this.color,this.number,this.shape,this.filling,null]; + } -} +}//export {Card} \ No newline at end of file diff --git a/Source/Model/Card5.js b/Source/Model/Card5.js index 5c03402..fc091fe 100644 --- a/Source/Model/Card5.js +++ b/Source/Model/Card5.js @@ -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]; } -} \ No newline at end of file +} +// export {Card5}; \ No newline at end of file