|
Answer» I am GOING to explain like strongly type object oriented language (OOPs) like(C#,C++ and java etc.).
Fist I am creating a conductor class and trying to achieve to declare the public, private and static variables and detail as given below.
FUNCTION myEmpConsepts() { // This myEmpConsepts is a constructor function. var empId = "00201"; //This is a private variable. this.empName = "Anil Singh"; //This is a public variable. this.getEmpSalary = function () { //This is a public method console.log("The getEmpSalary method is a public method") } } //This is a instace method and its CALL at the only one time when the call is instanciate. myEmpConsepts.prototype.empPublicDetail = function () { console.log("I am CALLING public vaiable in the istance method :" + this.empName); } //This is a static vaiable and its shared by all instace. myEmpConsepts.empStaticVaiable = "Department"; var instanciateToClass = new myEmpConsepts(); I am going to explain like strongly type object oriented language (OOPs) like(C#,C++ and java etc.). Fist I am creating a conductor class and trying to achieve to declare the public, private and static variables and detail as given below. function myEmpConsepts() { // This myEmpConsepts is a constructor function. var empId = "00201"; //This is a private variable. this.empName = "Anil Singh"; //This is a public variable. this.getEmpSalary = function () { //This is a public method console.log("The getEmpSalary method is a public method") } } //This is a instace method and its call at the only one time when the call is instanciate. myEmpConsepts.prototype.empPublicDetail = function () { console.log("I am calling public vaiable in the istance method :" + this.empName); } //This is a static vaiable and its shared by all instace. myEmpConsepts.empStaticVaiable = "Department"; var instanciateToClass = new myEmpConsepts();
|