About Question enthuware.ocajp.i.v7.2.907 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
ETS User

About Question enthuware.ocajp.i.v7.2.907 :

Post by ETS User »

If there is no visible constructor, the control, will not call default constructor for super class?

admin
Site Admin
Posts: 10045
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.907 :

Post by admin »

Your question is not clear. If there is no visible constructor in which class? the super class or the subclass?

When you instantiate a sub class, the subclass's constructor is called and that constructor can invoke any constructor of its superclass. If subclass's constructor does not call super class's constructor explicitly, then the compiler puts a call to super(); as the first line of the subclass's constructor.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

cyril090
Posts: 1
Joined: Fri Jan 03, 2014 10:59 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.907 :

Post by cyril090 »

Hi!

I have some doubts about:

"Note that if a subclass class constructor doesn't explicitly call the super class constructor, the compiler automatically inserts super(); as the first statement of the base class constructor. So option 5 is not needed."

I would say:

"Note that if a subclass class constructor doesn't explicitly call the super class constructor, the compiler automatically inserts super(); as the first statement of the subclass class constructor. So option 5 is not needed."

Peace.

admin
Site Admin
Posts: 10045
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.907 :

Post by admin »

You are right. This has now been fixed.

thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests