Thread: constructors in classes

  1. #16
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Ahh I get it that makes sense thanks quzah, and thanks Cat for trying.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  2. #17
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Is it really that simple? If the constructor were a part of the object, how could it be used to construct that very object ?
    The moment of creation for an object is when the code that resulted from the declaration or new call gets executed. In both cases the code FIRST allocates memory and THEN calls the constructor, passing a pointer to that memory as this pointer. The memory holds random content at that time, but that gets changed in the constructor.

    In effect, constructors and destructors are there to help the "blackbox" aspect of a class, to make a class a self-contained entity.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Classes and constructors help please
    By S_Diggy in forum C++ Programming
    Replies: 7
    Last Post: 08-27-2007, 12:03 PM
  2. classes and overloading constructors
    By barneygumble742 in forum C++ Programming
    Replies: 2
    Last Post: 09-14-2005, 05:32 AM
  3. Destructors and Constructors on classes
    By Da-Nuka in forum C++ Programming
    Replies: 14
    Last Post: 06-14-2005, 02:08 PM
  4. Classes: constructors, destructors ???
    By mbeisser21 in forum C++ Programming
    Replies: 18
    Last Post: 07-21-2002, 09:33 PM
  5. Replies: 2
    Last Post: 01-15-2002, 06:00 PM