How can I create a new class when I have many public classes Dog Cat Fish and Owner String Name age | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How can I create a new class when I have many public classes Dog Cat Fish and Owner String Name age

I want to make many classes in every pet with their information about age name owner

29th Sep 2016, 11:09 AM
Alexandr Gorbachev
Alexandr  Gorbachev - avatar
2 Antworten
+ 2
U can create only one class Animals and create objects of this class ,dog,cat,fish
29th Sep 2016, 11:11 AM
Oliver Brown
Oliver Brown - avatar
0
Create class Animal and have Dog, Cat, Fish inherit from Animal. That is a better design and adheres to object oriented programming.
29th Sep 2016, 12:39 PM
Mythos