Own implementations implementations access rights of

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ions implementations Access Rights of Derived Classes Access Type of Inheritance Inheritance Inheritance For instance, graphics objects might be For defined as follows: defined This hierarchy could, of course, be continued for more levels. Each level inherits the attributes of the above level. Shape is the base class. 2-D and 3-D are derived from Shape and Circle, Square, and Triangle are derived from 2-D. Similarly, Sphere, Cube, and Tetrahedron are derived from 3-D. Inheritance Concept Inheritance Polygon Rectangle Point Triangle Circle 3D-Point Parent and Child Classes Parent Inheritance Concept Inheritance Polygon Rectangle Triangle class Polygon { private: int width, length; int public: void set(int w, int l); void } class Rectangle{ private: int width, length; int public: void set(int w, int l); void int area(); int } class Triangle{ private: int width, length; int public: void set(int w, int l); void int area(); int } Inheritance Concept Inheritance Polygon Rec...
View Full Document

This document was uploaded on 03/16/2014.

Ask a homework question - tutors are online