Please enable JavaScript.
Coggle requires JavaScript to display documents.
OOP (ACCESS MODIFIERS (PUBLIC
Truy cập ngoài class, ở lớp con, PRIVATE
…
OOP
ACCESS MODIFIERS
PUBLIC
Truy cập ngoài class, ở lớp con
-
-
GENERIC
BASIC
class GeneryStudy {
public function PrintArr<T>(param:T[]):void{
Console.log(param);
}
}
VD: GeneryStudy.PrintAarr<number>([1,2,3]);
-
-
-
STATIC
Không cân khởi tạo đối tượng, gọi trực tiếp class
Vidu: Class todoSomething(){
public static name:string ="john";
}
console.log(todoSomething.name); => không cần khởi tạo đối tượng
-
ABSTRACT
- Khi sử dụng từ khóa abstract ở trước class
- Phải khởi tạo một lớp con kế thừa từ lớp abstract.
- Khởi tạo một đối tượng rồi mới truy cập đc.
- Phải tuân thủ theo abstract cha, cho có gì con phải làm theo.
VD: abstract class Laptop{
public function keyboard(){
console.log("Day la phần keyboar máy laptop");
}
}class lenovo extends Laptop (){
public function TinhTong(x:number, y:number):number{
return (x+y); }
}let laptop = new lenovo ()
laptop.keyboard();
-
-