Discussion Board
Go to the previous messageGo to the following message
Current Forum: Homework 3 Forum
Date: Thu Sep 27 2001 12:08 pm
Author: White, David <white3@andrew.cmu.edu>
Subject: Re: recursive

My opinion is that it is not recursive, because it isn't calling the same function.

The real question is how would Blah() ever be called? I assume that the where the first Blah is, is abstract, and you have redefined the function in a child class. You can only create an instance of the child class, so I'm not sure the Blah() function would ever be called.

For example:

abstract class Foo{
public Foo();
abstract int Blah(){return ((Child)this).Blah();}
}

public class Child extends Foo {
public Child();
public int Blah(){return Blah();}
}

public class Junk {
public void main()
{
Foo temp = (Foo)(new Child());
temp.Blah();
}
}

If that were the case, I think only the child class would be
called, not the base class's implementation...
Post response

Go to the previous messageGo to the following message
Current Thread Detail:
recursive      Cipriani, Jason A.      Thu Sep 27 2001 9:55 am       
Re: recursive      White, David      Thu Sep 27 2001 12:08 pm       
Re: recursive      Yuen, John      Thu Sep 27 2001 12:15 pm       
Re: recursive      Danish, Matt R.      Thu Sep 27 2001 12:42 pm       
Re: recursive      Cipriani, Jason A.      Thu Sep 27 2001 4:16 pm       
Re: recursive      Danish, Matt R.      Thu Sep 27 2001 7:38 pm       
Re: recursive      Lee, Peter      Fri Sep 28 2001 9:44 am       
Re: recursive      Danish, Matt R.      Fri Sep 28 2001 11:35 am       
Re: recursive      Lee, Peter      Fri Sep 28 2001 12:43 pm       

Back to previous screen