We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<iostream>usingnamespacestd;classRectangle{protected:intm_width,m_height;public:virtualvoiddisplay(){cout<<m_width<<" "<<m_height<<endl;}};classRectangleArea:publicRectangle{public:voidread_input(){cin>>m_width>>m_height;}voiddisplay()override{cout<<m_width*m_height;}};intmain(){/* * Declare a RectangleArea object */RectangleArear_area;/* * Read the width and height */r_area.read_input();/* * Print the width and height */r_area.Rectangle::display();/* * Print the area */r_area.display();return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Rectangle Area
You are viewing a single comment's thread. Return to all comments →