View Single Post
Old 12-11-2012, 02:39 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
I'm not sure exactly what it is you are trying to do here.
Subclassing abstracts that are nested are. . . a pain to say the least. I don't recommend doing it unless you need to. The problem is simply the scope.
Here's an example of that:
PHP Code:
public class theem
{
    public abstract class 
outer
    
{
        public abstract class 
Power
        
{

            public 
int[] jim;
            public 
Power(int vbint yt)
            {
                
jim = new int[]{vbyt};
            }
        }
    }

    class 
ConcretePower extends outer.Power
    
{
        public 
ConcretePower(outer outerint vbint yt)
        {
            
outer.super(vbyt);
        }
    }

    class 
ConcreteOuter extends outer
    
{
    }

    public static 
void main(String[] argv)
    {
        
theem t = new theem();
        
outer obj t.new ConcreteOuter();
        
outer.Power p t.new ConcretePower(obj14);
        for (
int i p.jim)
        {
            
System.out.println(i);
        }
    }

(I have no idea what these are doing, so I fudged my own compatible datatype for jim).

You'll notice that the nested abstracts are scoped against an instance of object theem (which I promoted to a concrete class and went with the new outer).

Perhaps its better to simply acknowledge the awesomeness that is the interface first which will give a much better understanding of the usefulness of the abstract. Ultimately the purpose here is to create multiple inheritance, where an object of my ConcretePower is both an instance of ConcretePower as well as an instance of theem.outer.Power. Therefore I can operate on it with any method provided in either of the classes.

As for placement in a file, I don't understand the problem. Nothing says you need to nest abstracts. Nesting in Java is already IMO a pain to keep track of everything.
Fou-Lu is offline   Reply With Quote