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

When not to use object oriented programming?

0 Answers  


write a program to find 2^n+1 ?

0 Answers   CTS,


can we make game by using c

1 Answers   SmartData,


write a program that takes input in digits and display the result in words from 1 to 1000

0 Answers   Wipro,


How Do you Code Composition and Aggregation in C++ ?

3 Answers   IBM, NET,






write a c++ program to find maximum of two numbers using inline functions.

3 Answers   IBM,


what is polymorpsim? what are its types?

8 Answers  


Get me a number puzzle game-program

0 Answers  


What are functions in oop?

0 Answers  


what is the difference between class to class type conversion and copy constructor ?

2 Answers  


What do you mean by inheritance?

0 Answers   IBS,


wht is ditch

0 Answers  


Categories