Campbell wrote:In its most basic form, a bean is an object with a no‑arguments constructor and getXXX() and setXXX() methods for each field. Any field can be used to remember information from a previous method call. What would you want to remember?
An object can only “see into” a calling object if that object passes information on to it; remember methods don't “know” where they were called from.
kevin Abel wrote:The class gets instantiated and follows rules in its constructor class if it has one.
It lives in the heap.
On the stack there is a reference variable.
If I make a frog object can it do frog stuff like hopping while the rest of the code is performing other tasks?
The object sees something calling it.
It looks for a match of object types and position. It uses the one that matches.
It can remember things from the last time it was used.
I t will return values if the private, public grantors allow it.
Do you mean Stephan?kevin Abel wrote:Stephen
No, it isn't. It behaves totally differently from a method.. . . A constructor is a method.
Please say, “constructor,” full stop. A constructor belongs more to the object being created than to the class, but it has to be written in the class.Switching the words around to "class constructor" makes some more sense. Maybe the class's constructor is even better. . . .
kevin Abel wrote:A constructor is a method.
Switching the words around to "class constructor" makes some more sense. Maybe the class's constructor is even better.
Don't get me started about those stupid light bulbs. |