Classes are used to model physical or conceptual entities. An example of physical entities may be the class Animal - an abstract base class. Derived from that are classes such as Cat, Dog, Human, Bird, etc. Derived from Cat are things like WildCat (Leopard, Tiger, Lion, Puma), DomesticatedCat (Abysinian, Siamese), et al. You model basic behaviors in the base classes, and then refine those behaviors in the derived classes. Example: all animals eat food. Some animals only eat meat. Others eat meat and vegetables. And others may only eat vegetables and/or fruit. By using virtual inheritance, you can create a class like DomesticatedCat from the generic Cat class, and with a reference to it as simply an instance of Cat, you can ask what it eats - and it will give you the appropriate answer - mice, cat food, milk/cream, etc. If you create an instance of Lion, and reference it as another Cat, then when you ask what it eats it may come back with Gazelle, Deer, UnwaryHuman, etc. :-)
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...