When the design recommends static functions?

Answers were Sorted based on User's Feedback



When the design recommends static functions?..

Answer / manu

The design reccommends static functions when you need to
call the function even when the class is not instantiated.

Is This Answer Correct ?    5 Yes 0 No

When the design recommends static functions?..

Answer / aruna kumar samal

When you want to use the function inside the program , not
outside then dsign recomend to do so. This does not have a
this pointer.static function maynot be virtual.there will
not be same version of static and non static function.

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C++ General Interview Questions

Can constructor be private in c++?

0 Answers  


What is pointer with example?

0 Answers  


What is the use of function pointer?

0 Answers  


Are strings mutable in c++?

0 Answers  


Do we have private destructors?

12 Answers   Symphony, TCS,






What is the default access level?

0 Answers  


Is java based off c++?

0 Answers  


What is the use of bit fields in structure declaration?

0 Answers  


how can i access a direct (absolute, not the offset) memory address? here is what i tried: wrote a program that ask's for an address from the user, creates a FAR pointer to that adress and shows it. then the user can increment/decrement the value in that address by pressing p(inc+) and m(dec-). NOW, i compiled that program and opened it twice (in 2 different windows) and gave twice the same address to it. now look what happen - if i change the value in one "window" of the program, it DOES NOT change in the other! even if they point to the same address in the memory! here is the code snippet: //------------------------------------------------------ #include <stdio.h> //INCLUDE EVERY KNOWN HEADER FILE #include <conio.h> //FOR ANY CASE... #include <iostream.h> #include <dos.h> #include <process.h> main() { int far *ptr; //FAR POINTER!!! long address; char key=0; //A KEY FROM THE KEYBOARD int temp=0; clrscr(); cout<<"Enter Address:"; cin>>hex>>address; //GETS THE ADDRESS clrscr(); (long)ptr=address; temp=*ptr; //PUTS THE ADDRESS IN THE PTR cout<<"["<<hex<<(unsigned long)ptr<<"]="<<*ptr<<" = "<< (char)(*ptr); //SHOWS: [address]=value=ASCII symbol. while (key!=27) //WHILE YOU DONT PRESS ESC. { while(!kbhit()) //WHILE KEY IS NOT PRESSED { if (temp!=*ptr) { temp=*ptr; clrscr(); cout<<"["<<hex<< (unsigned long)ptr<<"]="<<*ptr<<" = "<<(char)(*ptr); }; //IF THE VALUE HAS CHANGED, CLEAR THE SCREEN AND SHOW //AGAIN if (key=='p') {key=0; (*ptr)++; } //INCREMENT VALUE if (key=='m') {key=0; (*ptr)--; } //DEC. VALUE }; key=getch(); //IF A KEY IS PRESSED, READ IT FROM THE //KEYBOARD }; return 0; //IF ESC WAS THE KEY, EXIT THE PROGRAM } //---------------------------------------------------------

0 Answers  


How to declaring variables in c++?

0 Answers  


Write a function to find the nth item from the end of a linked list in a single pass.

0 Answers   Huawei,


What is the difference between #import and #include in c++?

0 Answers  


Categories