[ create a new paste ] login | about

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

C++, pasted on Jun 21:
#include <bits/stdc++.h>
using namespace std;

//Base class
class Parent
{
    public:
      int id_p;
};
 
// Sub class inheriting from Base Class(Parent)
class Child : public Parent
{
    public:
      int id_c;
};

//main function
int main() 
   {
     
        Child *obj1;
        Parent obj2;
        obj1 = &obj2;
}


Output:
1
2
3
4
Line 24: error: bits/stdc++.h: No such file or directory
In function 'int main()':
Line 24: error: invalid conversion from 'Parent*' to 'Child*'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: