January 2011
Intermediate to advanced
1648 pages
70h 30m
English
new OperatorWe already know a couple of ways to create instances of types: the use of literals and default value expressions. And because expressions evaluate to produce something of a certain type, they can be used in all places where objects are expected.
However, so far we’ve yet to discuss one of the most common ways of creating object instances: the use of constructors. Constructors are nothing but regular methods that are defined on a type but are known to serve a special goal: They return an instance of the containing type. Every type can have different constructors that take in different arguments, as a matter of friendliness toward the consumer of the type. This is facilitated by means of method overloading ...
Read now
Unlock full access