how do u initialize the constant variables

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is overloading in oop?

653


What is the oops and benefits of oops programming?

636


What is polymorphism and types?

680


What is coupling in oop?

690


What is the difference between abstraction and polymorphism?

714






what are the realtime excercises in C++?

2431


What is object in oop?

782


What is static in oop?

686


any one please tell me the purpose of operator overloading

2059


Can you explain polymorphism?

677


What are the features of oop?

734


Write a program to implement OOPS concepts such as inheritance, polymorphism, friend function, operator overloading?

4343


How to hide the base class functionality in Inheritance?

738


2. Give the different notations for the class.\

1670


Can we create object of interface?

699