This page was last updated on March 13th, 2020(UTC) and it is currently May 30th, 2023(UTC).
That means this page is 3 years, 78 days, 3 hours, 16 minutes and 44 seconds old. Please keep that in mind.
36 - Function Overloading
In an attempt to squash the ever persistant issue (at least, this is my hypothesis, anyway) of name clashing (things with the same name but aren't even remotely the same), they came up with a feature that almost nobody uses called "namespaces." It's actually quite useful, but even I forget about it when I actually need it. May you not fall victim to the same fate if you choose to use C++.
#include <stdio.h>
//------------------------------------------------------------------------
namespace cat { void kitty(){ printf("meow!\n"); } }
//------------------------------------------------------------------------
namespace cat2 { void kitty(){ printf("meow meow!\n"); } }
//------------------------------------------------------------------------
extern "C" void meow(){
using namespace cat2;
cat::kitty();
kitty();
}
Get your own web kitty here!
©Copyright 2010-2023. All rights reserved.