Low Level Programming Session Summary
11th October
This session I learned more about virtual functions and their uses, to divide up the workload of a programmer and to be able to be used with multiple functions. I learnt about virtual function tables which are a hand written tool which can allow a programmer to see where and when virtual functions are used within their base and derived classes. This allows for a much more complex understanding of the code base, allowing for possible manipulation and guidance.
I relearned about header guards being used in header files. While I have seen these before, it is always good to recap them as they are rather important when dealing with multiple files. My own preference is to use the '#pragma once' mark as a header guard. Still, what they do is they make sure that each and every file is only complied once which prevents large system errors from occurring.
We talked about default parameters for virtual functions which are the base function's defaults, this is what it will use if it isn't given anything else. These must be done after being initialised, otherwise errors will occur. Defaults are overridden with the derived class' parameters if the derived class specifies some other parameter to pass to the function, that way they are still used unless we specify that we don't want to use them. This can be useful to set as the most commonly used value, or a null value unless we want it to be used.
Pre-compiled headers are header files which have already been complied at run time, and are only used when our code base doesn't change a lot. They are only used in large projects and it is unlikely I will have to deal with them. Still, they do speed up code compilation.
We recapped forward declaration which I used quite a lot, unless I was using classes. It's a great way to get multiple functions in a file, however I have used this so often I didn't need to recap it.
We also recapped dynamic and static memory allocation which again, I knew a fair bit about. Still, always good to recap. Looking forward to next session and learning more about OOP.
No comments:
Post a Comment