Lectures 11 & 12

it had to come one moment … inheritance (maybe one of the the most important concepts in object -oriented ¬†programming, along with the two other ones: polymorphism and encapsulation¬†)

1:06 today is the day …


Read more of this post

Advertisements

C++.. PART4

Ok … so let’s go further becasue it seems that this was a quite long-time approach. Anyway I don’t want to wander into useless details but on the other hand I don’t want to miss something that could be important.

18. Class vs Struct – this will be just a discussion about C structs and C++ classes, so emphasizing the main aspects of object oriented programming.
C structures are the part of C language which makes the transition to C++ and object oriented programming. In C they were designed to be more some data
containers, that’s why in C structs you cannot add functions (if it is to take into consideration differences between C++ structs and C++ classes only
the default access type will be considered: public for struct, private for class). When defined a C++ class does not take memory storage, it happens
only when it is instantiated.

But how things are really passing concerning classes’ declaration, definition and instantiation? Basically classes’ definitions are kept in header files and their
declarations and instantiations in source files, in other words everything that does not have an active role in programs’ execution is kept in headers and the program itself, the part that is indeed executed is kept in .c files. This is not mandatory, this is not requested by the standard, but is just a guideline.

Also a frequent practice in designing classes is to declare its members as private and corresponding functions, which access them as public. Actually
this is the very nature of encapsulation, classes’ characteristics are not visible outside of the class but can be modified from within by some functions
which are accessible from outside.

Go on further to #19