[ create a new paste ] login | about

Link: http://codepad.org/l1BsfzJB    [ raw code | output | fork ]

C++, pasted on Mar 17:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<iostream>
using namespace std;

class base{
   const static int m=5; 
    enum {c1 = 10};   
    int &i;
    const int l;
  public:
    base(int z ): i(z):l(z) {cout <<"i & l are " << i<<l<< endl;}
};

int main()
{
  base obj(5);
  cout <<sizeof(obj)<<endl;  
    
}


Output:
1
2
3
t.cpp: In constructor 'base::base(int)':
Line 10: error: uninitialized member 'base::l' with 'const' type 'const int'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: