9
======================================= = DeVry College of New York COMP 220 Lab #7: Polymorphism Name – DSI – June 19, 2014 Objective: Write a program demonstrates polymorphism with the use of abstract classes and virtual functions by using a generalized procedure with a Shape abstract class as an parameter, but then passing in derived classes objects as arguments. Tools required : PC & Visual studio software Code: // Test Main CCP #include <iostream> #include <iomanip> #include <string> #include "Circle.h" #include "Rectangle.h" using namespace std; void createShapeObjects( void ); void usingObjectArrays( void ); void displayArrayObjects(Shape *shapeArray, int size);

COMP 220 Lab Week7

  • Upload
    lu

  • View
    5

  • Download
    0

Embed Size (px)

DESCRIPTION

C++ codes

Citation preview

========================================DeVry College of New YorkCOMP 220Lab #7: Polymorphism Name DSI June 19, 2014

Objective: Write a program demonstrates polymorphism with the use of abstract classes and virtual functions by using a generalized procedure with a Shape abstract class as an parameter, but then passing in derived classes objects as arguments.

Tools required: PC & Visual studio software

Code:// Test Main CCP#include#include#include#include"Circle.h"#include"Rectangle.h"

using namespace std;

void createShapeObjects(void);

void usingObjectArrays(void);

void displayArrayObjects(Shape *shapeArray, int size);

void printShapeInformation(Shape *shapePtr);

void main(void)

{

char ch;

cout