Posts

Showing posts from July, 2015

How To Code Inheritance and Polymorphism in C

C++ Code -------------- #include &ltiostream&gt #include &ltcstdlib&gt using namespace std; class base { public:     base();     virtual ~base();     virtual void draw();     void initialize(); private:     int value; }; base::base() {     cout << "base\n"; } base::~base(){     cout << "~base\n"; } void base::draw(){     cout << "base draw\n"; } void base::initialize() {     cout << "initialize\n"; } class child : public base { public:     child();     ~child();     virtual void draw(); private:     int number; }; child::child(){     cout << "child\n"; } child::~child() {     cout << "~child\n"; } void child::draw() {     cout << " child draw\n"; } int main(int argc, char** argv) {     cout << "non dynamic\n";     child c;     c.initialize();     c.draw();     base* b = &c;     b->

How To Setup NetBeans in C/C++

If you have Visual Studio from Microsoft well great but if you're not fortunate to have the commercial tool you have NetBeans which can run in both MS Windows and Linux. So, to setup NetBeans you need the following, - Download and install NetBeans with C/C++ support - Download and install MingW - Download and install MSys inside the base directory of MingW - Point the environment variables "path" to where the /bin of MingW and MSys - Run NetBeans and go to \Tools\Options\C++ and add in the tool chain the base directory of MingW - For the C compiler point the path to C:\Program Files (x86)\mingw-w64\i686-5.1.0-posix-dwarf-rt_v4-rev0\mingw32\bin\i686-w64-mingw32-gcc.exe - For the C++ compiler point the path to C:\Program Files (x86)\mingw-w64\i686-5.1.0-posix-dwarf-rt_v4-rev0\mingw32\bin\i686-w64-mingw32-c++.exe - For the debugger point the path to C:\Program Files (x86)\mingw-w64\i686-5.1.0-posix-dwarf-rt_v4-rev0\mingw32\bin\gdb.exe - For the make point the path