APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY Previous Years Question Paper & Answer

Course : B.Tech

Semester : SEMESTER 6

Year : 2018

Term : MARCH

Scheme : 2015 Full Time

Course Code : EC 312

Page:9





PDF Text (Beta):

using namespace std;

// Base class
class Shape {
public:
void setWidth(int w) {
width = w;
}
void setHeight(int h) {

height = h;

protected:
int width;
int height;

35

// Derived class
class Rectangle: public Shape {
public:
int getArea() {

return (width * height);

35

int main(void) {

Rectangle Rect;

Rect.setWidth(5);

Rect.setHeight(7);

Similar Question Papers