add input for ex8.3
This commit is contained in:
		
							parent
							
								
									17845570ef
								
							
						
					
					
						commit
						fae6435f3c
					
				
					 2 changed files with 39 additions and 0 deletions
				
			
		
							
								
								
									
										16
									
								
								ex8.3/Shape.hh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								ex8.3/Shape.hh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,16 @@ | |||
| #ifndef SHAPE_HH | ||||
| #define SHAPE_HH | ||||
| 
 | ||||
| class Shape { | ||||
| public: | ||||
| 
 | ||||
|   // Constructor, destructor
 | ||||
|   Shape() {} ; | ||||
|   virtual ~Shape() {} ; | ||||
| 
 | ||||
|   // Pure virtual interface functions
 | ||||
|   virtual double surface() const = 0 ; | ||||
|   virtual double circumference() const = 0 ; | ||||
| } ; | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										23
									
								
								ex8.3/Square.hh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								ex8.3/Square.hh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| #ifndef SQUARE_HH | ||||
| #define SQUARE_HH | ||||
| 
 | ||||
| #include "Shape.hh" | ||||
| 
 | ||||
| class Square: public Shape { | ||||
| public: | ||||
| 
 | ||||
|   // Constructor, destructor
 | ||||
|   Square(double size) : _size(size) {} ; | ||||
|   virtual ~Square() {} ; | ||||
| 
 | ||||
|   // Implementation of abstract interface
 | ||||
|   virtual double surface() const { return _size * _size ; } | ||||
|   virtual double circumference() const { return 4 * _size ; } | ||||
| 
 | ||||
| private: | ||||
| 
 | ||||
|   double _size ; | ||||
| 
 | ||||
| } ; | ||||
| 
 | ||||
| #endif | ||||
		Reference in a new issue
	
	 Frank Filthaut
						Frank Filthaut