What does the keyword "static" mean?
Answers were Sorted based on User's Feedback
Answer / subhashish sen
static keyword is used with both variables and
functions.when a static variables means it retains its value
for different function calls and in C++ this variable is
used mainly for counting no. of objects of a class and it is
not confined to a particular object and for static member
functions its can only manipulate static variables and a
static member function can be invoked without an object of
class.
Is This Answer Correct ? | 13 Yes | 0 No |
Answer / mangai
static functions are used to retain the last assigned
value...static function creates only one copy of arguments
and uses it...
Is This Answer Correct ? | 4 Yes | 1 No |
Answer / anjana priyadharshini
Static:
static is one of the key word of the language c++.static means constant
Is This Answer Correct ? | 1 Yes | 6 No |
What is Dynamic Polymorphism?
Why oops is important?
c++ provides classes...and classes do what we want but why then strcut are used...if we say data hiding... it is also provided by c++ in structs then why to prefer clasess
WRITE A SIMPLE C++ PROGRAM TO SWAP TWO NOS WITHOUT USING TEMP
What is polymorphism and example?
What is polymorphism programming?
What is a scope resolution operator?
Question In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Question Submitted By :: Sunil Kumar I also faced this Question!! Rank Answer Posted By Re: In a class, there is a reference or pointer of an object of another class embedded, and the memory is either allocated or assigned to the new object created for this class. In the constructor, parameters are passed to initialize the data members and the embedded object reference to get inialized. What measures or design change should be advised for proper destruction and avioding memory leaks, getting pointers dangling for the embedded object memory allocation? Please suggest. Answer # 1 use copy constructors 0 Shanthila There is something to be taken care in destructor, in copy constructor, suppose the memory is assigned to the embedded member object pointer with the parameter passed value, but if some other objects of different class also are pointing to this memory, then if some one deletes the object then this class member pointer object will become dangling, or if the object is not deleted properly then there will be memory leak. Please suggest the design change required to handle or avoid this situation
c++ is a pure object oriented programming or not?
#include <string.h> #include <stdio.h> #include <stdlib.h> #include<conio.h> void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort
tell about copy constructor
why oops need in programming