Simple syntax question on classes

This is a discussion on Simple syntax question on classes within the C++ Programming forums, part of the General Programming Boards category; Well you know that rule where after you define a class you can have some instances of that class to ...

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    Simple syntax question on classes

    Well you know that rule where after you define a class you can have some instances of that class to declare immeditaely following the }? Well I can't inf it anywhere in my book and I'm not sure of the exact syntax. My best guess is:

    } Instance1, Instance 2;

    but I'm not 100% sure, so if anyone can help I'd really appreciate it. Thanks.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Yes that is the correct syntax.
    Code:
    class Simple
    {
        private:
          int m_x;
          int m_y;
    } *COORD, POINTS;
    There I declare a pointer to my class and a regular instance of the class.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Thanks a lot! In fact - you actually answered a question I forgot to ask in your code as well!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Includes making me insane >.<
    By IceDane in forum C Programming
    Replies: 14
    Last Post: 04-14-2008, 11:24 AM
  2. Replies: 2
    Last Post: 07-28-2006, 03:59 PM
  3. Simple Question about Classes
    By Loctan in forum C++ Programming
    Replies: 5
    Last Post: 06-26-2006, 03:40 AM
  4. 2 simple question
    By blue_gene in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2004, 08:11 AM
  5. Simple yes/no question regarding classes
    By Ricochet in forum C++ Programming
    Replies: 5
    Last Post: 12-11-2003, 05:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21