-
Notifications
You must be signed in to change notification settings - Fork 1
05 Classes and Objects
anjali0706 edited this page Aug 5, 2019
·
4 revisions
class <class_name>{
field;
method;
}
//defining constructor
constructor(id: number, name:string) {
this.id = id;
this.name = name;
}
// defining function FunctionName():void{ console.log("Name : "+this.name+", id : "+this.id) }
var obj = new ClassName(arguments);
// accessing variables console.log(obj.id) console.log(obj.name)
// calling functions student1.FunctionName() student2.FunctionName()