-1

I was reading through the source code of a program written in C++ when I came across a few function declarations like this:

virtual bool _Open(LPCTSTR aFileSpec, DWORD &aFlags) = 0;

Why is this declared function being set equal to zero?

Additional Question: (Edit)

What would a statement like this mean?

virtual __int64 _Length() const = 0;

What other keywords could replace const, and what would they mean?

10101100
  • 1
  • 1
  • 1
    This doesn't address the question, but names that begin with an underscore followed by a capital letter (`_Open`) and names that contain two consecutive underscores are reserved for use by the implementation. The person wrote that code is playing with fire. – Pete Becker Jun 16 '19 at 19:58
  • @PeteBecker • It takes a child playing with fire to raze a village. – Eljay Jun 16 '19 at 20:06
  • @PeteBecker: What does "reserved for use by the implementation" mean? What is the "implementation"? – 10101100 Jun 16 '19 at 20:39
  • @10101100 — “the implementation” refers to the compiler and its version of the standard library. Nobody else should define names like that. – Pete Becker Jun 17 '19 at 00:06

1 Answers1

2

This is a pure virtual function: https://en.cppreference.com/w/cpp/language/abstract_class

Deriving non-abstract classes are expected to implement it.

erenon
  • 18,838
  • 2
  • 61
  • 93