how do u initialize the constant variables

Answers were Sorted based on User's Feedback



how do u initialize the constant variables..

Answer / subu

const int pp = 100;

Is This Answer Correct ?    8 Yes 1 No

how do u initialize the constant variables..

Answer / sachin

In Constructor Initialization list

Is This Answer Correct ?    9 Yes 3 No

how do u initialize the constant variables..

Answer / keshav.gadde

class sam
{
const int x;
public:
sam(int i):x(i)
{
cout<<i<<endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
sam s(10);
return 0;
}

Is This Answer Correct ?    4 Yes 0 No

how do u initialize the constant variables..

Answer / bibin joy

class A
{
const int mConstVal ;
A():mConstVal (10)
{

}

}

Is This Answer Correct ?    4 Yes 1 No

how do u initialize the constant variables..

Answer / yughandhar

as for my knowledge,the constant variables are intialised by
keyword called DEFINE
Eg:
#define pie=3.14

Is This Answer Correct ?    4 Yes 7 No

Post New Answer

More OOPS Interview Questions

tel me oops defination in single line

2 Answers  


Can enum be null?

0 Answers  


what is the size of an empty class

12 Answers   Wipro,


Write a macro for swapping integers

5 Answers  


#include <string.h> #include <stdio.h> #include <stdlib.h> #include <conio.h> void select(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); select(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void select(char *items, int count) { register int a, b, c; int exchange; char t; for(a = 0; a < count-1; ++a) { exchange = 0; c = a; t = items[ a ]; for(b = a + 1; b < count; ++b) { if(items[ b ] < t) { c = b; t = items[ b ]; exchange = 1; } } if(exchange) { items[ c ] = items[ a ]; items[ a ] = t; } } } design an algorithm for Selection Sort

0 Answers  






What is this pointer in oop?

0 Answers  


What is object in oop with example?

0 Answers  


What is encapsulation?

17 Answers   TCS,


What is methods in oop?

0 Answers  


Which language is pure oop?

0 Answers  


tell about copy constructor

3 Answers   Siemens,


What do you mean by pure virtual functions?

8 Answers  


Categories