Indicate that a function call is calling a static function?
Is it possible to indicate that a class function you are calling is static?
class Point
{
std::string name;
public:
Point(){}
static void DisplayName() { std::cout << "Point" << std::endl;}
};
int main()
{
Point.DisplayName(); //this doesn't indicate the the member function is static
//maybe something like this:
//static_call(Point.DisplayName()); //just to indicate to the reader that this call makes sense without an instance of the class
}
There are several times where I dont remember even in my own code that I am calling a static function.
Thanks,
Dave
daviddoria
Posting Virtuoso
1,996 posts since Feb 2008
Reputation Points: 437
Solved Threads: 204
Use the functions qualified name i.e. class_name::function_name(parameteres)
In your case, call it as:
Point::DisplayName()
This will make clear that DisplayName is either a static function from a class Point or it is a Simple function in the Point namespace.
If the code reader knows that Point is a class, he will surly understand that DisplayName is a static member.
siddhant3s
Practically a Posting Shark
816 posts since Oct 2007
Reputation Points: 1,486
Solved Threads: 140