Difference between static and non static data members in c++


Asked by admin @ in Computer Science viewed by 308 People


Difference between static and non static data members in c++

Answered by admin @



Static namespace scope variables have internal linkage, while non-static namespace scope variables have external linkage by default! Details: a const namespace scope variable has internal linkage by default. That linkage can by changed by keyword extern.
static variables in a class is associated with the class, that means, all instances of the class have the same instances of the static variables; they’re like a global variables that every instance of the same class has access to.
non-static variables in a class are instance members, that is, every instance of the class will have its own instances of the non-static variables.
a static data member of a class has external linkage if the name of the class has external linkage. [$3.5/5]
a static variable inside a function retains its value even after returning from the function. That is, its lifetime is equal to the lifetime of the program itself.

Similar Questions

Difference between primitive and non primitive data structure

Asked by admin @ in Computer Science viewed by 352 persons

Difference between primitive and non primitive data structures in tabular form

What is the difference between primary and secondary data sources

Asked by admin @ in Business viewed by 350 persons

What is the difference between primary data and secondary data?

How to tell the difference between continuous and discrete data

Asked by admin @ in Mathematics viewed by 334 persons

describe the difference between the graph of a set of discrete data and the graph of a set of continuous data

Difference between uniform acceleration and non uniform acceleration

Asked by admin @ in Physics viewed by 350 persons

Difference between uniform and non uniform acceleration

Difference between noisy and noiseless channels in data communication

Asked by admin @ in Computer Science viewed by 506 persons

Difference between noisy and noiseless channels in computer networks

Difference between non profit concern and non trading concern

Asked by admin @ in Accountancy viewed by 542 persons

Distinction between non-profit concern and non-trading concern​

Collection of different data types that are grouped together

Asked by admin @ in Science viewed by 356 persons

What is a collection of different data types that are grouped together?

What are the basic data types associated with c

Asked by admin @ in Computer Science viewed by 347 persons

What are the basic data types associated with C?

Not a valid data type in c programming language

Asked by admin @ in Computer Science viewed by 426 persons

Which of the following is not a valid data type in C language? a) Char b) float c) long d) double

Sum and difference of two numbers in c hackerrank solution

Asked by admin @ in Math viewed by 381 persons

Sum and difference of two numbers hackerrank solution

What is the main difference between sorting and filtering data

Asked by admin @ in Computer Science viewed by 368 persons

What is the basic difference between sorting and filtering the data

Darnell collected data from two different

Asked by maham237 @ in Mathematics viewed by 1024 persons

Darnell collected data from two different sales teams in his department, each with four employees. The results of the study, based on each worker's ages and sales, are listed below:Which …

Difference of polynomials and non polynomials

Asked by maham237 @ in Mathematics viewed by 296 persons

How different are polynomials from non-polynomials?​

What is the difference between verbal and non verbal communication

Asked by maham237 @ in English viewed by 322 persons

A. There is no difference between verbal and nonverbal communication. B. Verbal communication only occurs when in a foreign country since nonverbal communication is not understood. C. Verbal communication is …

What is the difference between qualitative data and quantitative data

Asked by admin @ in Medicine viewed by 345 persons

Explain the difference between qualitative and quantitative data, and give one example of each.

Most viewed questions in Computer Science


A programmer mistakenly writes gor instead of for

Asked by admin @ in Computer Science viewed by 19018 persons


Domestic data entry operator ncert book class 9 solutions

Asked by admin @ in Computer Science viewed by 15805 persons


Information technology code 402 class 9 solutions chapter 1

Asked by admin @ in Computer Science viewed by 10969 persons



Ncert solutions for class 8 computer chapter 1 computer system

Asked by admin @ in Computer Science viewed by 10401 persons


A scrum team works on a 4 weeks sprint

Asked by admin @ in Computer Science viewed by 8721 persons


Which of the following occupies more memory in c

Asked by admin @ in Computer Science viewed by 8135 persons



A database of motor vehicles has the base entity

Asked by admin @ in Computer Science viewed by 7840 persons


The network architecture can be termed as a mcq

Asked by admin @ in Computer Science viewed by 6485 persons


Cat5 and cat6 cabling refer to which reference model layer

Asked by admin @ in Computer Science viewed by 5788 persons



Class 7 computer chapter 3 questions and answers

Asked by admin @ in Computer Science viewed by 5691 persons


Choose the correct options about usability and user experience

Asked by admin @ in Computer Science viewed by 5474 persons


Which advocates daily team meetings for coordination and integration

Asked by admin @ in Computer Science viewed by 4980 persons



Which three security features match the database security level

Asked by admin @ in Computer Science viewed by 4970 persons


Which of the dbms package is not available

Asked by admin @ in Computer Science viewed by 4682 persons


________ aid a business grow and attain its objectives

Asked by admin @ in Computer Science viewed by 4486 persons