Hi to all,i have to make project with the classes.Can anyone suggest the topic for the project?Or show the idea.Thank you.
4 Years
Discussion Span
Last Post by rubberman

Maybe a class of students and their subjects... Cars and their makes, maths with polynomials... Depends what interests you.


If you have to deep into inheritance and polymorphism perhaps bank account system is good to implement


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. :-)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.