+ 1

can someone tell me how to use abstract class and not how to make them please

2nd Jun 2017, 4:32 AM
DoubleVermine
DoubleVermine - avatar
2 Antworten
0
If you don't know what to do with it, you propbably do not need it. (not always the case, but in this case it is.) An abstract class is a class you cannot create a instance off. You only can derive from this class. An abstract class is not necessary but more cosmetic. First you have the object hierachy and than you decided that there are some classes that are not usefull to be instantiated. Or classes that could create bugs/ unexpected behaviour when being instantiated from. Those classes can be made abstract. Like in the csharp.net-tutorails. You want the animal to be defined. It has to be a dog or a cat. So you need to force the user not to create a animal object. But you want the dog and the cat to share the common ground of the animal class, If there is a abstract class you want to have a instance off. Create your own class, derive from the abstract class and created a instance of your class.
2nd Jun 2017, 6:12 PM
sneeze
sneeze - avatar