Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
Build your AI Agent
GfG 160
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
Contests
Accenture Hackathon (Ending Soon!)
GfG Weekly [Rated Contest]
Job-A-Thon Hiring Challenge
All Contests and Events
DSA
Practice Problems
Python
C
C++
Java
Courses
Machine Learning
DevOps
Web Development
System Design
Aptitude
Projects
Sign In
▲
Similar Topics
Java
10.1k+ articles
C++
4k+ articles
C++ Programs
2.5k+ articles
C Language
1.8k+ articles
CPP Examples
700+ articles
C++ Quiz
140+ articles
Functions
87 articles
cpp-class
57 articles
CPP-OOPs
47 articles
Static Keyword
29 articles
C++-Static Keyword
18 posts
Popular Articles
Recent Articles
How to Declare a Static Variable in a Class in C++?
Last Updated: 15 February 2024
In C++, a static variable is initialized only once and exists independently of any class objects so they can be accessed without creating an
...read more
cpp-class
C++
C++-Static Keyword
Static Keyword
C++ Programs
Picked
CPP-OOPs
CPP Examples
Static Member Function in C++
Last Updated: 20 December 2022
The static keyword is used with a variable to make the memory of the variable static once a static variable is declared its memory can't be
...read more
Technical Scripter
C++
C++-Static Keyword
Picked
Technical Scripter 2022
Difference between static and constant function in C++
Last Updated: 04 May 2021
Static Function: It is a member function that is used to access only static data members. It cannot access non-static data members not even
...read more
C++
Functions
C++-Static Keyword
C++ Programs
Similar Topics
Java
10.1k+ articles
C++
4k+ articles
C++ Programs
2.5k+ articles
C Language
1.8k+ articles
CPP Examples
700+ articles
C++ Quiz
140+ articles
Functions
87+ articles
cpp-class
57+ articles
CPP-OOPs
47+ articles
Static Keyword
29+ articles
Difference between Static and Friend Function in C++
Last Updated: 28 December 2022
Static Function: It is basically a member function that can be called even when the object of the class is not initialized. These functions
...read more
C++
Functions
C++-Static Keyword
C++-Friend function and class
Difference Between
Memory Allocation in Static Data Members in C++
Last Updated: 14 June 2020
C++ allows defining static data members within a class using the static keyword. When a data member is declared as static, then we must keep
...read more
C++
C++-Static Keyword
Memory Management
Count the number of objects using Static member function
Last Updated: 29 March 2020
Prerequisite : Static variables , Static FunctionsWrite a program to design a class having static member function named showcount() which ha
...read more
Misc
C Language
C++
C++-Static Keyword
Static Keyword
C++ | Static Keyword | Question 6
Last Updated: 28 June 2021
Output of following C++ program?[sourcecode language="CPP"]#include iostreamclass Test{public: void fun();};static void Test::fun() {
...read more
C Language
C++ Quiz
C++-Static Keyword
Static Keyword
Static Objects in C++
Last Updated: 14 March 2023
Prerequisite: Static Keyword in C++An object becomes static when a static keyword is used in its declaration. Static objects are initialized
...read more
cpp-class
cpp-storage-classes
cpp-constructor
C++
C++-Static Keyword
Static Keyword
C++ | Static Keyword | Question 4
Last Updated: 28 June 2021
Predict the output of following C++ program.[sourcecode language="CPP"]#include iostreamusing namespace std;class A{private: int x;public
...read more
C Language
C++ Quiz
C++-Static Keyword
Static Keyword
C++ | Static Keyword | Question 3
Last Updated: 29 July 2020
Which of the following is true?(A) Static methods cannot be overloaded.(B) Static data members can only be accessed by static methods.(C) No
...read more
C++ Quiz
C++-Static Keyword
Static Keyword
C++ | Static Keyword | Question 2
Last Updated: 28 June 2021
[sourcecode language="C"]#include iostreamusing namespace std;class Player{private: int id; static int next_id;public: int getID()
...read more
C Language
C++ Quiz
C++-Static Keyword
Static Keyword
C++ | Static Keyword | Question 1
Last Updated: 28 June 2021
Predict the output of following C++ program.[sourcecode language="CPP"]#include iostreamusing namespace std;class Test{ static int x;publ
...read more
C Language
C++ Quiz
C++-Static Keyword
Static Keyword
Comparison of static keyword in C++ and Java
Last Updated: 05 September 2023
Static keyword is used for almost the same purpose in both C++ and Java. There are some differences though. This post covers similarities an
...read more
Java
C++
C++-Static Keyword
Static Keyword
Some interesting facts about static member functions in C++
Last Updated: 30 October 2020
1) static member functions do not have this pointer.For example following program fails in compilation with error "`this' is unavailable for
...read more
C++
C++-Static Keyword
Static Keyword
Can Static Functions Be Virtual in C++?
Last Updated: 06 June 2022
In C++, a static member function of a class cannot be virtual. Virtual functions are invoked when you have a pointer or reference to an inst
...read more
C Language
C++
C++-Static Keyword
Static Keyword
1
2
>>
Last
1
2
>>
Last
1
2
>>
Last
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !