What is the reason for not using abstract
keyword in C++? As I read the only way to declare a class as abstract is to declare pure virtual function in it, which is a bit convoluted. Why isn't there a more direct way of declaring an abstract class?
Asked
Active
Viewed 178 times
3

Wojtek
- 801
- 1
- 9
- 13
-
[Microsoft](http://msdn.microsoft.com/en-us/library/b0z6b513.aspx) has added it. I have no idea if they use it though. – keyser Dec 28 '14 at 13:14
-
3Not exactly a duplicate judging by the title, but the accepted answer's got a quote directly from Stroustrup explaining it. – jrok Dec 28 '14 at 13:19
-
1@jrok Which is the only way to truly answer this question :) – keyser Dec 28 '14 at 13:20
2 Answers
1
I think that the main reason is unwillingness to introduce a new keyword. All was tried to do in the frames of C keywords.

Vlad from Moscow
- 301,070
- 26
- 186
- 335
0
Why declaring a pure virtual function is not "direct" enough? This way has more sense than declaring the whole class abstract. Compiler should probably assume that all methods are virtual in that case. That would lead to extra overhead etc...
At the end, if you like that, you can always switch to C#, or similar language.

guest
- 51
- 3