Recommended Answers
Jump to PostIf the private data is static, i.e. all instances of the class share the static private data, then there is no need for the class object as an argument.
If the private data is non-static, then you must have the class object as an argument because the object instance …
Jump to PostSo can you explain a little bit on Static thing?
Essentially a static member variable (be it of any type) is a variable that is common to all non-static instances of the class.
Maybe the following explains it a bit ..#include<iostream> using namespace std; // forward …
Jump to Postcan I use combination of static variable and friend function to expose that variable to only one method of another class?
Yes you can, like so ..
#include<iostream> using namespace std; // forward declaration class A; class B { public: B(){} void set(int ii); }; class A …
Jump to PostCan this Static variable be a pointer?
Yes it can. About small tutorials, I'd bet that you'll find reasonable ones by searching the web for example "static member variable in c++".
All 13 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.