# Example - Using typedef

    #include <iostream>

    #include <string>

    typedef struct clients

      { string sname;

        string fname;

        float due;

      } MyClient;

    MyClient& getClient(MyClient&);

    int main(void)

    {

     MyClient client;

     client = getClient(client);

     cout << client.fname << " "

          << client.sname << " due "

          << client.due

          << endl;

      return 0;

    }

    MyClient& getClient(MyClient& c)

    { c.sname = "Portal";

      c.fname = "Joanna";

      c.due   = 1001.92;

      return c;

    }

Return to lesson

Copyright © 1999 - 2001 David Beech