Question: I want to write an abstract class so whoever inherits it, he will be forced to implement a specific function inside it.

**For example I wrote:**

```
class Car {
    virtual double getFuelConsumption(int speed) = 0;
};

```

But If I write the following it compiles with **no compilation error** (even though it didn't implement getFuelConsumption())

```
class meme : public Car {};

```

---

Update:
Why I'm getting error:
(I know that if it's exactly a car then it doesn't have `getFuelConsumption` implemented what what if it's a class that inherits class `Car`, I want this to work)

```
double getPetrol(std::vector<Road> roads, const Car &car) {
car.getFuelConsumption(1);
}

```

```
> 'this' argument to member function 'getFuelConsumption' has type
> 'const Car', but function is not marked const

```

Answer: 
The code you wrote is OK, as long as nobody instanciates a `meme`. This is by design.

As far as the compiler is concerned, your plan might very well be:

```
class meme : public Car
{

};

class ConcreteMeme : public meme
{
    virtual double getFuelConsumption(int speed) {return 2.0;}
};

```

Since you may want intermediate interfaces, there's no issue. The problem shows only when you try to instanciate a class that has a pure virtual method. If the compiler were to prevent you from having `meme`, you'd end up in a situation where you can't have `ConcreteMeme`.
The code you have is fine, `meme` will not be usable at all without the pure virtual method(s) being implemented. The only reason it compiles now is that you haven't actually tried to use it.