Questions tagged [class-hierarchy]

Class hierarchy refers to a set of classes and their inter-relationships.

A classification of object types, denoting objects as the instantiations of classes (class is like a blueprint, the object is what is built from that blueprint) inter-relating the various classes by relationships such as "inherits", "extends", "is an abstraction of", "an interface definition".

http://en.wikipedia.org/wiki/Class_hierarchy

276 questions
-1
votes
1 answer

Can a subclass type variable refer to a superclass object?

In Java's class hierarchy, can an object be initialized in such a manner? subclass object = new superclass(); This assumes that both the subclass and superclass have proper constructors, can compile, etc. Is this type of object construction…
auxilarus
  • 3
  • 3
-1
votes
2 answers

How get fields of hierarchy fields of java classes?

I have a abstract class called ClassA in my java project. I extends ClassB from ClassA. Now I want to get all fields of ClassB. When I use ClassB.getDelaredFields(), this method get only classB fields. I can use ClassA.getDeclaredFields() but When I…
Morteza Malvandi
  • 1,656
  • 7
  • 30
  • 73
-2
votes
2 answers

How to represent a multilevel hierarchy in Java

I am trying to make an Android application where you can buy and sell items. I've run into a wall: I am stuck at how to represent categories and sub-categories. Any category can have some number of sub-categories, and these sub-categories can also…
matn
  • 37
  • 7
-2
votes
4 answers

In a hierarchy, how son constructor can set members of grandfather constructor in c++

In a hierarchy, how son constructor can set members of grandfather constructor in c++. grandfather>father>son
my time
  • 39
  • 6
-3
votes
1 answer

Confusion on Java Polymorphism regarding method calling

I am having trouble with this Java Question: Consider the following classes: ​ public class Computer extends Mineral { public void b() { System.out.println("Computer b"); super.b(); } public void c() { …
-5
votes
2 answers

Understanding Class Hierarchy & OOP as it relates to Arrays.asList type conversion issue

I'm studying the book Thinking in Java. My question is why no there is no type conversion exception in this line: List snow4 = Arrays.asList(new Light(), new Heavy()); even though the new Light() and new Heavy() are Powder type, in the…
yanbit
  • 47
  • 5
1 2 3
18
19