Whats the difference between using a class and interface?

Viewed 2125

What is the difference between doing this

export class Comment {
  likes: string;
  comment: string;

  constructor(likes: string, comment: string){
    this.comment = comment;
    this.likes = likes;
  }
}

and this

export interface CommentInterface {
  likes: string;
  comment: string;
}

in relation to declaring an observable type

register: Observable<CommentInterface[]> {
    return this.http.get()
}
2 Answers
Related