11 lines
		
	
	
		
			154 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
		
			154 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
let nextId = 1;
 | 
						|
 | 
						|
export class Hero {
 | 
						|
  id: number;
 | 
						|
  constructor(
 | 
						|
    public name: string,
 | 
						|
    public power?: string) {
 | 
						|
      this.id = nextId++;
 | 
						|
    }
 | 
						|
}
 |