Tuesday, March 17, 2015

program to demonstrate the use of initializer list? (C plusplus or C++)

Aim: Write a program to demonstrate the use of initializer list ?
Ans.

#include<iostream.h>
#include<conio.h>
class A
{
const int a,b;
public:
            A(int x,int y):a(x),b(y)
            {

            }
            void d()
            {
            cout<<"a="<<a<<"\n"<<"b="<<b;
            }
}obj(10,34);
void main()
{
            clrscr();
            obj.d();
            getch();
}




No comments:

Post a Comment