[ create a new paste ] login | about

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

C++, pasted on Aug 10:
#include <iostream>
using namespace std;

class cFirst{
protected:
    int param;
public:
    cFirst(){
        param = 1;
    }
    int data(){
        return param;
    }
};

class cSecond : public cFirst{
protected:
    int param;
public:
      cSecond(){
        param = 2;
    }
    int data(){
        return param + cFirst::param;
    }
};

int main(){
    cSecond test;
    cout<<test.data()<<endl;
    return 0;
}


Output:
1
3


Create a new paste based on this one


Comments: