     14.8. FRANCH.CPP (   ) 

  1: 	// franch.cpp 
  2:
  3:	#include <iostream.h>                    
  4:	#include <string.h>        
  5:
  6:	class Company {
  7:	private: 
  8:                char *name;                                                  
  9:	public:                                
10:	  Company(const char *s) {	
11:	    name = strdup(s); 
12:                cout << " In constructor for" ;
13:	    Display() ;
14: 	  }
15: 	  virtual ~Company() {
16: 	    cout << " In destractor for";
17:	    Display() ;
18:	    delete name;                                    
19:	  }
20:	  void Oisplay(void) { cout  name  '\n';   } 
21:	}
22: 
23:	class Jennys:  public Company {
24:	public: 
25:	  Jennys():  Company("Jenny's") { }
26:	}
27: 
28:	class McDougles:  public Company {    
29:	public:                                      
30:	  McDougles():  Company( "McDougles")  { }   
31:	}
32:	
33:	class BurgerOueen:  public Company {   
34:	public:                               
35:	  BurgerQueen():  Company ("BurgerQueen") { } 
36:	} ;                                                                    
37:	
38:	class Bob                                 
39:	:  public Jennys,                         
40:	   public McDougles {                                   
41:	}
42: 
43:	class Ted 
44:	  : public McDougles, 
45:	    public BurgerOueen { 
46:	}
47: 
48:	class Alice                        
49:	   : public Jennys,	
50:	     public McDougles,                   
51:	     public BurgerQueen {
52:	 }
53:		
54:	main() 
55:	{ 
56:	   Bob *bobp; 
57:	   Ted  *tedp; 
58:	   Alice *alicep; 
59: 
60:	  cout  "\nlnitializing Bob's restaurant\n"; 
61:	  bobp = new Bob; 
62:	  cout  "Initializing Ted's restaurant\n"; 
63:	  tedp = new Ted; 
64:	  cout  "Initializing Alice's restaurant\n"; 
65:	  alicep = new Alice; 
66: 
67:	  cout  "\nDeleting Bob's restaurant\n";
68:	  delete bobp; 
69:	  cout  "Deleting Ted's restaurant\n"; 
70:	  delete tedp; 
71:	  cout  "Deleting Alice's restaurant\n";	
72:	  delete alicep;	
73:	
74:	  return 0; 
75:	} 
    
    
    362	 III.   ANSI C++
