function person ()
Public://notice this public! In fact, there is no such use, it is only my habit. Fortunately, there is no mistake in practical application
Private://As public, this is my habit.
function Person_mfgetname ()
var myperson=new person ();
You can use any output statement to view the results. Of course this is only the first step!
Here is a key step: Inherit!
function Student ()//Extends Class:person
This. Super=person; The definition points to its parent class builder. The super here can't be in lowercase.
This. Super (); Call its parent class builder. This allows you to inherit all of the properties and methods from the parent class
Although the GetName () method is not seen in student, it can be invoked. Because he has inherited the person's GetName () method.
var mystudent=new Student ();
Mystudent.getname (); Note that the GetName method of its "parent class" is invoked, resulting in the return of "Guest".
1: In "subclass" first defines a function pointing to "parent class" (any name can be, I am accustomed to using super)
2: Then call this function
This allows you to inherit all the properties and methods of the parent class!
I wonder if there is any better way? I hope you will advise ...