solareenlo / 42Old-CPP_Module_00

Old-CPP Module 00

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

42Old-CPP_Module_00

ex02

Time format

Static member function

Static member functions have no *this pointer

Static member functions have two interesting quirks worth noting. First, because static member functions are not attached to an object, they have no this pointer! This makes sense when you think about it -- the this pointer always points to the object that the member function is working on. Static member functions do not work on an object, so the this pointer is not needed.

Second, static member functions can directly access other static members (variables or functions), but not non-static members. This is because non-static members must belong to a class object, and static member functions have no class object to work with!

Ref: 12.14 — Static member functions

About

Old-CPP Module 00


Languages

Language:C++ 86.2%Language:Makefile 13.8%