Category Archives: cpp facts

Casting Operators of C++ (Static Cast).

This is the first casting operator provided in c++. Syntax for using this operator is var=static_cast<type_id>expression static_cast can perform conversions between pointers to related classes, not only from the derived class to its base, but also from a base class to its derived. … Continue reading

Posted in cpp facts | Tagged | Leave a comment

Adding more to function overloading in c++

Predict the output of following C++ program. #include<iostream> using namespace std; class Test { protected:     int x; public:     Test (int i):x(i) { }     void fun() const     {         cout << “fun() const called ” << endl;     }     void fun()     {         cout … Continue reading

Posted in cpp facts | Leave a comment