Thread: A Question On Reference Type

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #16
    System Novice siavoshkc's Avatar
    Join Date
    Jan 2006
    Location
    Tehran
    Posts
    1,246
    This code compiled and ran successfully:
    Code:
    #include <iostream>
    
    using namespace std;
    
    
    class Test {
    public:
        Test() { cout << "Test" << (int)this << endl; }
        ~Test() { cout << "~Test" << endl; }
          void test(){cout <<"fun"<<endl;}
    };
    
    int main()
    {
        Test& t = Test();
          t.test();
        cout << "main" << endl;
    
        return 0;
    }
    [edit]
    Whenever you create an object
    Where did we create an object in
    Code:
    Test();
    ?
    Last edited by siavoshkc; 08-15-2008 at 01:17 PM.
    Learn C++ (C++ Books, C Books, FAQ, Forum Search)
    Code painter latest version on sourceforge DOWNLOAD NOW!
    Download FSB Data Integrity Tester.
    Siavosh K C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using Vectors. MinGW warning
    By Viewer in forum C++ Programming
    Replies: 9
    Last Post: 03-26-2009, 03:15 PM
  2. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  3. Using VC Toolkit 2003
    By Noobwaker in forum Windows Programming
    Replies: 8
    Last Post: 03-13-2006, 07:33 AM
  4. question about .net to 6.0 change causing errors
    By jverkoey in forum C++ Programming
    Replies: 17
    Last Post: 03-23-2004, 10:45 AM
  5. Question type program for beginners
    By Kirdra in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2002, 05:10 AM