Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some details in step 13c Constructor #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions step13c_constructor/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// If parent class provide constructor(with or without argument)
//then you must have to create constructor in child class
// and must call super()
// then you must have to create constructor in child class and must call super()
//If you want to initialize the members of the child class differently than the parent class.
//otherwise If the child class does not define its own constructor, it will inherit the constructor of the parent class.
// Below code will not work because it does not call super,

// Case 1:
Expand Down Expand Up @@ -66,7 +67,10 @@ class F extends E {
console.log("F constrcutor");


//super("Hello",5); // Multiple supper call working, No error here -- seems to be some special case
//super("Hello",5);
// Multiple supper call working, No error here -- seems to be some special case
// but when we'll run this code it'll give us "ReferenceError: Super constructor may only be called once"

}
}
let e: E = new E("E",1);
Expand Down