2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
@file
|
|
|
|
|
|
|
|
@verbatim
|
|
|
|
PURPOSE:
|
|
|
|
( Test abstract class pointers )
|
|
|
|
@endverbatim
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2015-03-23 21:03:14 +00:00
|
|
|
#ifndef BALL_HH
|
|
|
|
#define BALL_HH
|
2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
class Ball {
|
|
|
|
public:
|
|
|
|
virtual ~Ball() {} ;
|
|
|
|
virtual void print_type() = 0 ;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
class Baseball : public Ball {
|
|
|
|
public:
|
|
|
|
Baseball() {} ;
|
|
|
|
~Baseball() {} ;
|
|
|
|
virtual void print_type() { std::cout << "baseball" << std::endl ; } ;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
class Soccerball : public Ball {
|
|
|
|
public:
|
|
|
|
Soccerball() {} ;
|
|
|
|
~Soccerball() {} ;
|
|
|
|
virtual void print_type() { std::cout << "soccer ball" << std::endl ; } ;
|
|
|
|
} ;
|
|
|
|
|
|
|
|
#endif
|