Thread: reference to self ... so to speak

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    9
    wouldn't that be pointing to itself then?

    I want to point to the same type but a different instance

  2. #2
    Registered User
    Join Date
    Oct 2008
    Posts
    9
    essentialy I want to do this
    Code:
    class myClass{
        
        myClass *pointer;
    
    }

  3. #3
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Quote Originally Posted by scorche View Post
    essentialy I want to do this
    Code:
    class myClass{
        
        myClass *pointer;
    
    }
    It's really just assigning

    pointer = this;

    But then you could just use "this" directly.

    edit:
    I think I really must be missing something in the question
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  4. #4
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by scorche View Post
    essentialy I want to do this
    Code:
    class myClass{
        
        myClass *pointer;
    
    }
    Sorry to burst your bubble, but:
    Code:
    class myClass
    {
        myClass* pointer;
    }
    This is a pointer to the same class type.

    Code:
    class myClass
    {
        myClass& reference;
    }
    This is a reference to the same class type.

    And this is C++, not C (big difference).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM