There are following definitions
template <class T> class TDB{
      T* rp;
      int num;
public:   TDB(int n)  { rp=new T[num=n];}
      ~TDB()  { delete [ ]rp;}
       T& GetRec(int rn){
               T*crp=rp;
                if (0<=rn && rn<num)
                     while (rn-->0)
 crp++;
       return *crp;
       }
   };

class TRec {
                   private: char name[21];
                   public: TRec() {name[0]=0;}
TRec(const char * s) { Assign(s);}
void Assign(const char * s) { strncpy(name,s,20);}
char * Get() {return name;}
               };

 TDB<TRec *> *pdb;  
How to add one element to pdb array?

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Cosmo
Sign Up Now
or Subscribe for future quizzes