what is a ststic variable and stiticfunction
briefly explain with exmple and in which case we use

Answer Posted / subhashish sen

When a variable is declared with static keyword,its called
as static variable,means it retains its value across
different function calls.Its basically used for counting no
of objects created for a class in C++ and its initialized to
0 by default.

When a function declared as static,its called as static
function.It can only operate on static variables.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

2784


What is abstraction example?

803


Which type does string inherit from?

806


How do you answer polymorphism?

772


Why is oop better than procedural?

785


Where You Can Use Interface in your Project

1591


write a program to find 2^n+1 ?

1759


Can a destructor be called directly?

778


What are the benefits of polymorphism?

839


This program numbers the lines found in a text file. Write a program that reads text from a file and outputs each line preceded by a line number. Print the line number right-adjusted in a field of 3 spaces. Follow the line number with a colon, then one space, then the text of the line. You should get a character at a time and write code to ignore leading blanks on each line. You may assume that the lines are short enough to fit within a line on the screen. Otherwise, allow default printer or screen output behavior if the line is too long (i.e., wrap or truncate). A somewhat harder version determines the number of spaces needed in the field for the line numbers by counting lines before processing the lines of the file. This version of the program should insert a new line after the last complete word that will fit within a 72-character line.

1838


What is difference between data abstraction and encapsulation?

813


Where is pseudocode used?

718


What is the real time example of encapsulation?

780


Why do we use polymorphism?

742


What is constructor overloading in oop?

822