+ 1

Difference between virtual and abstract

some time ago i learned Java and there was an abstract declaration is that the same as virtual in C++ if not what are the differences?

3rd Nov 2016, 4:45 PM
Project Erebos
Project Erebos - avatar
4 odpowiedzi
+ 2
An abstract method can't have functions implemented within it, it needs to have only generic declarations that will be overridden by its child. Now, virtual methods have full functionality on their own and may be overridden or not, as the child demands.
3rd Nov 2016, 5:21 PM
Hanike T.
Hanike T. - avatar
+ 1
so a true virtual Funktion (Funktion() = 0 ;) would be the equivalent?
3rd Nov 2016, 7:47 PM
Project Erebos
Project Erebos - avatar
0
Auf keinen Fall! Abstract, virtual and pure virtual functions are 3 very different things. But you can use all three mixed in the same class in C++ afaik.
4th Nov 2016, 1:49 AM
Hanike T.
Hanike T. - avatar
0
ok thx
4th Nov 2016, 1:51 AM
Project Erebos
Project Erebos - avatar