[ create a new paste ] login | about

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

C++, pasted on Oct 13:
#include <iostream>
using namespace std;

class Object{
     public:
        int i;
        Object(int x);
};

Object::Object(int x){
     i = x;
}

int main(){
    Object *pointer;
    pointer = new Object(23);
    cout << "pointer->i = " << pointer->i << "\n";

    Object pointer2(55);
    cout << "pointer2.i = " << pointer2.i << "\n";
    cout << "(*pointer2)->i = " << pointer->i << "\n";
}


Output:
1
2
3
pointer->i = 23
pointer2.i = 55
(*pointer2)->i = 23


Create a new paste based on this one


Comments: