elenora Rezaie wrote:Hi, I have two classes called A and the second one is B...
I doubt you do. In the real world, those classes will have
names, not letters; and what those names are is
very important.
If this is simply a question from a book or course, then you may have only been
given A and B, but it's worth thinking about some real-life scanerio that they might exist in. But in order to do that you need to give them
names.
For example: from your description, I have no idea whether B is a
subclass of A or not. They could easily be siblings, both of which are subclasses of some parent class, or interface.
My suggestion: Try and come up with some names for A and B, and then ask the same question to
yourself and see if it still makes sense. if it doesn't, then come back and ask us the same question -
but give us those names. We'll soon tell you if they don't make any sense, but we may be better equipped to help you with the
rest of your question.
Winston