My learning..
Fun Programming
Starting with some acronyms which i would be using very frequently.
TIL - Today I Learned.
--- in C++, while using polymorphism one must define base class destructor as virtual. otherwise only the destructor of pointer type will be called.
--- class and structures are similarly organized into memory unless polymorphism is not included. e.g.
class test
{
int i;
int j;
};
struct testStructure
{
int i;
int j;
};
though all the variables by default in class are private still you can access these variables by typecasting class pointer to a structure pointer.
test* a = new test;
testStructure* ptr = (testStructure*) a;
play with a as ptr->i & ptr->j...
any senior would kill you for doing such programming.. but its fun.
--- Closing a socket in forked process will not cause any affect on the socket in the parent process.
it seems kernel maintains kind of smart pointer to the socket & when all the process stop using kernel socket. then only it closes actual kernel socket towards the network. Need to do more work on that.