Thread: Simple syntax question on classes

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912

    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
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    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, 10:24 AM
  2. Replies: 2
    Last Post: 07-28-2006, 02:59 PM
  3. Simple Question about Classes
    By Loctan in forum C++ Programming
    Replies: 5
    Last Post: 06-26-2006, 02:40 AM
  4. 2 simple question
    By blue_gene in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2004, 07: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