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

Is html an oop?

0 Answers  


What do you mean by overloading?

0 Answers  


What are the four main oops concepts?

1 Answers  


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

1 Answers   HCL, TCS,


Why we are use # in begning of programme of c++.

2 Answers   Syntel,






In what situation factory design patterns,DAO design patterns,singleton design patterns should be applied.?

2 Answers  


What is multiple inheritance? Give Example

6 Answers   Mind Tree,


Can a varargs method be overloaded?

0 Answers  


What are the different forms of polymorphism??

8 Answers   Mantaq, NUC, PCS,


given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy

0 Answers   DELL,


What is a mixin class?

4 Answers  


What is the importance of oop?

0 Answers  


Categories