*/
Got something to write about? Check out our Article Builder.
*/

View \#2.CPP

Some Introductory C++ Code Examples

Submitted By: WEBMASTER
Rating: starhalf star (Rate It)


enum bool { false, true, unknown };

class boolean {
      bool * var;
  public:
      boolean(bool b) { var = new bool; *var = b; }
      ~boolean() { delete var; }
};

class no_constructor {
        bool none;
  public:
        ~no_constructor() {}
};

class no_destructor {
        bool none;
  public:
        no_destructor() {}
};

class nothing {
};

void proc1(void);
void proc2(void);

main()
{
        bool           yes = true;
        boolean        test(yes);
        no_constructor x1;
        no_destructor  x2;
        nothing        x3;

        proc1();
        proc2();

        exit(0);
}

void proc1()
{
        boolean y(false);

        return;
}

void proc2()
{
        boolean z();

        return;
}

/* output:

 */

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.