|
-
Oct 26th, 2006, 09:38 AM
#1
Thread Starter
Frenzied Member
are variables also initialised in the constructor of the superclass?
Hello
I was reading about the construction of constructors and this article says
The first thing that happens inside the constructor is that the constructor of the class's superclass is called.
Then, each class attribute of the object is initialized. These are the attributes that are part of the class definition (instance variables), not the attributes inside the constructor or any other method (local variables). In the DataBaseReader code presented earlier, the integer startPosition is an instance variable of the class.
Then, the rest of the code in the constructor executes.
(http://www.developer.com/design/arti...0925_3516911_3)
if there are any local variables to the superclass, will these variables be initialised in the constructor of the superclass.
w.e. if we have two classes dog and cat each derived from a superclass animal. will variables to do with say number of legs = 4 be initialised within the seuperclass animal?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|