Created
June 21, 2018 23:49
-
-
Save Zoomelectrico/6ba4526733d05cd67eb63a6be6206c9c to your computer and use it in GitHub Desktop.
Clase Nodo TypeScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @class Node | |
*/ | |
export default class Node { | |
private data: any; | |
private next: Node; | |
/** | |
* @constructor constructor de la clase | |
* @param data {any} el dato que quieres que el nodo contenga | |
*/ | |
constructor(data: any) { | |
this.data = data; | |
this.next = null; | |
} | |
/** | |
* @function getNext | |
* @return null si el siguiente nodo es null o el siguiente nodo de la lista | |
*/ | |
public getNext(): Node { | |
return this.next; | |
} | |
public getData(): any { | |
return this.data; | |
} | |
public setNext(next: Node): void { | |
this.next = next; | |
} | |
public setData(data: any): void { | |
this.data = data; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment