-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccess_modifiers.js
More file actions
68 lines (68 loc) · 2.75 KB
/
Access_modifiers.js
File metadata and controls
68 lines (68 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// ***************All Access-Modifiers Code Present Here*****************
// # Step : 1 Public
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
// class Student
// {
// public studid: number;
// studName: string;
// }
// let stud = new Student();
// stud.studid = 101;
// stud.studName = "Vishal"+ " Phone Number";
// console.log(stud.studid+ " "+stud.studName);
// ***************All Access-Modifiers Code Present Here*****************
// # Step : 1 Private
// class Student
// {
// public stud1: number;
// private studName: string;
// constructor(s1: number, name: string){
// this.stud1 = s1;
// this.studName = name;
// }
// public display()
// {
// return (`Code Access: ${this.stud1}, my name: ${this.studName}.`);
// }
// }
// let student: Student = new Student(1, "Saurabh");
// console.log(student.display());
// ***************All Access-Modifiers Code Present Here*****************
// # Step : 1 Protected
var Student = /** @class */ (function () {
function Student(code, name) {
this.studCode = code;
this.studName = name;
}
return Student;
}());
var Person = /** @class */ (function (_super) {
__extends(Person, _super);
function Person(code, name, department) {
var _this = _super.call(this, code, name) || this;
_this.department = department;
return _this;
}
Person.prototype.getElevatorPitch = function () {
// If you want to Run this code then, Make a new Function With given Anytype of Name And Return some value okkk.......
// console.log(**********************Hello Access Modifiers************************);
return ("My unique code:------------------- ".concat(this.studCode, ", -------------my name: ").concat(this.studName, " -----------and I am in ").concat(this.department, " ------Branch."));
};
return Person;
}(Student));
var v1 = new Person(1, "v1", "CS");
console.log(v1.getElevatorPitch());