Monday, 5 October 2015

Low Level Programming Session Summary 2, 5th October

Low Level Programming Session Summary

5th October

This session I started out knowing rather little about virtual functions and their uses. I now know that they take up a lot of memory space and that you shouldn't use them if you don't need to. Virtual functions are useful for the class structure but one should be careful when implementing them, it may backfire and cause more problems than it solves. 

To delete a virtual function and all the functions derived from that virtual function, one only needs to use the delete keyword in the destructor. This means that the function as well as all the separate functions derived from that virtual function will be deleted at the same time. This allows for quick and easy management of that memory space and so that you don't have to delete all the functions from every single class which may be irritating when one has a large number of classes.

Classes are very useful things, however this session I learnt that you can get bogged down using them. It is best to be concise with classes so that you can manage them effectively and they don't get too big. This will help in the long term by reducing code duplication and helping you manage the whole code base.

In order to use a new function instead of the base virtual function, one must use the 'over-ride' keyword in order to make sure that the class uses the function you want instead of the base class' version of the function. This is useful for ensuring that the function does what you want it to and limits the functionality for you. 

I learnt that you can chain constructors and therefore have multiple different things built at different times. Though C++ is inefficient when it comes to its constructors, it may be useful to have multiple of these so that one can delegate resources at runtime. 

We can also use the scope resolution '::' to specify which class and instance we wish to run giving us greater control over how the class runs and operates.

I will certainly need to go over some of these notes and I found the tutorial rather challenging. Not quite all of it is in my head but I will be going back over it in my spare time so that I can confirm what has been said and that I can make sure I know all of these things. 

No comments:

Post a Comment