0
What is abstract for?
i know what private and public are for but i dont really understand what i would use abstract for? keep it simple please :)
6 Answers
0
If you want a function in a class to be executed, but you don't know how it should be executed, for example if you work in a team.
0
Abstract classes are classes that you can't make objects of. If you try it should throw an error
0
sounds pointless can yoi give me an example what i would use it for please?
0
I'm not sure since I'm not a java dev, but, imagine you have a superclass Animal, and a subclass cat, you want Animal class to be abstract, there's no animals called Animal, right? So you only can have Cats.
Not sure if thats the best example, but is the best I could think of.
0
thanks noname < wouldent that be classed as a name lol đ anyway thanks i think i get it
0
You could just rename the Animal class to Cat, and forget about abstraction, but what if you had to create a class Duck? We put the in common attributes in the animal class and the unique attributes in Cat and Duck classes. This has a name I can't remember.