donaldth smithts wrote:if we add
to the class bellow will it work or will get a bug?
if it will give a bug then it will be on the compiler problem or running time problem?
Pierluigi Di Giacomo wrote:Didn't test the code yet but I think that it will generate a compiler error of "incompatible types"...
. . . and delete that last post.We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
Campbell Ritchie wrote:I know it may be too late, but as Jeff has said, you do not help people by providing a straight answer like that. Don’t be annoyed with me, but I shall have to pull rank, remind you what it says at the beginning of this forum:
. . . and delete that last post.We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
donaldth smithts wrote:this is the tree,how does it helps me seeing why i dont get the proper responce/?
donaldth smithts wrote:regarding
I thought it would cheat the compiler becuase of the casting
and it would fail on the running time.
but the compiler said incompatible types.
why??
also on this line
i thought it would use the b method of B,but it used the b method of G
why??
alex lotel wrote: regarding
D and E classes both inherit class C
still cant see why casting wont cheat the compiler
Joanne
That looks more like BlueJ’s class diagram, with the classes set out randomly. Can’t you move the classes round so they are in order? And so you can actually read it?alex lotel wrote:this is the tree, . . .
alex lotel wrote:
my question is in general in what cases we can cheat the compiler
alex lotel wrote:
regarding this line:
why the compiler said that we cannot cast F into G
??
alex lotel wrote:I understood that we cant a non specific variable to a specific like e=c
but we can cheat thec complier because one extends the other directly?
but what if E extends G
and G extends C
i.e we have one class in the middle
will it still be cheated
my question is in general in what cases we can cheat the compiler.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
expectation is the root of all heartache - shakespeare. tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|