CSE 115 Lecture Notes - Lecture 36: Pariah Dog

56 views3 pages

Document Summary

Defining more than one constructor for a class is an example of overloading. Generally, a name can be overloaded with multiple definitions, as long as the correct interpretation of the name can be determined by the compiler from context. Methods and constructors can be overloaded as long as the name can be disambiguated based on the call. If no explicit constructor is defined for a class, the compiler provides one. This default constructor takes no arguments and has an empty body public class b { public b() { super(); Any constructor which does not explicitly call a superclass constructor implicitly invokes the no-argument constructor of the superclass. An explicit invocation of a superclass constructor is done using super". The first statement in a constructor must be a call to a constructor. Often this call is to a superclass constructor, but it can be to another constructor of the same class.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions