|
|
|
|
|
by ryao
297 days ago
|
|
> Yes. Since we are not in C++ we can choose to get rid of this useless pointer. If you were trying to implement OOP in the kernel in C and implemented a vtable, you cannot get rid of the this pointer in vtable entries since a child class might want to use it in the overrode definition. It is one of the same reasons why you cannot remove it in C++. The entire point of a vtable is to enable inheritance. If OOP really were being done, an out of tree module could make a class that inherits from this one without needing any code changes and use the this pointer, but you cannot do that if you drop the this pointer. I already explained this. |
|
You already prescribe with the chosen arguments in the superclass on which things the child implementation can depend. Why not also do this with the first argument?