Answer Posted / madhu
In C++ when you declare and define a static variable, it
tells the compiler that only one copy of memory will be
allocated and all the objects of that class will share that
copy.
As we know for class data variables memory will be created
independently for every object of that class. and we can
access the data using object. But, for static variables
memory is created only once for all objects and is no object
is owned the static variable. we can access the static
variable using class name.
Mainly static variables are used when want to count the
objects created and destroyed and when we are dealing with
singleton design pattern.
| Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
Why is destructor used?
What is overloading and its types?
What is solid in oops?
write string class as your own class in java without using any built-in function
Can an interface inherit a class?
Please send ford technologies placement paper 2 my mail id
What are the benefits of interface?
write a C++ program for booking using constructor and destructor.
What is the advantage of oop over procedural language?
What are two types of polymorphism?
What is and I oop mean?
What are the 5 oop principles?
Whats oop mean?
What is data binding in oops?