|
-
September 28th, 1999, 05:48 AM
#1
Type Casting
Dear All
I encounterd a quetion related type casting.
Question is
class class1{}
class class2 extends class1{}
class class3 extends class3{}
A. class3’s parent class is class2, and class2’s parent class is class1.
B. class3’s parent class is class2, class2’s parent class is class1, and class1’s parent is Object.
C. class1’s parent class is class2, and class2’s parent class is class3.
D. class1’s parent class is class2, class2’s parent class is class3, and class3’s parent is Object.
Answer is A , but i don't know how (A) is correct
If any one know please explain me.
-
September 28th, 1999, 07:24 AM
#2
Re: Type Casting
> class class1{}
By default , all classes are extends from Object. So , the answer is B
-
September 28th, 1999, 07:37 AM
#3
Re: Type Casting
Dera poochi
Please tell me diff between class1 & class3.
From my knowledge
class1 & class3 both are subclass of object.
Is any benefit to drive a class by itself as class3.
-
September 28th, 1999, 09:17 AM
#4
Re: Type Casting
> class class3 extends class3{}
you cant inherit like this. I thought it was a typing mistake.
It has to be like "class class3 extends class2{}" otherwise you will get
"Cyclic class inheritance" compilation error.
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
|