Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have some difficulty in understanding your question. I try here to summarize your problem statement,please comment if this is indeed what your question is.<br> (I would have put this as a comment but the number of characters exceed 600)</p> <p> <li>You have classes <code>ImageA</code> and <code>ImageB</code> that are subclasses of <code>Image</code></li> <li>Constructor for both these classes is the same and accepts a path argument (which I presume to be the path of image file)</li> <li>Classes <code>ImageA</code> and <code>ImageB</code> use different attributes to represent the image <li>Common attributes classes <code>ImageA</code> and <code>ImageB</code> are kept in the base class (like the path attribute) <li>You declare an abstract method <code>compare</code> which takes an <code>Image</code> type as argument and returns a double value <li>The goal is to pass to compare method of <code>ImageA</code> a type of <code>ImageB</code> and the return value would indicate which concrete image representation is better. So this would mean that implementation of <code>compare</code> method should be such that, <code>compare</code> method in class <code>ImageA</code> will be called with instance of type <code>ImageB</code> and viceversa will be the implementation in class <code>ImageB</code> <li>The compare method in classes <code>ImageA</code> and <code>ImageB</code> cannot use methods in <code>Image</code> since they have different attributes </p> <p>If this problem statement indeed represents your problem, then I think is without resorting to checks like <code>instanceof</code> and casting it won't be possible to do the comparison between classes <code>ImageA</code> and <code>ImageB</code>. Though there is an abstract class <code>Image</code> the <code>compare</code> method still depends on what image attributes (which are not the same) the child classes use to represent an image.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload