About 276,000 results
Open links in new tab
  1. How do I create a class object in C++? - Stack Overflow

    I have a Java background. In Java we create class object like this. Example example = new Example(); The Example class can have constructor or cannot have constructor. I can use the …

  2. new operator - Creation of an object in C++ - Stack Overflow

    Apr 15, 2010 · new A (); creates and constructs an object of type A and puts it on the heap. It returns a pointer of that type. In other words new returns the address of where the object was …

  3. How to create an instance of a struct in C++? - Stack Overflow

    I would advise against using pointers here, though. Unlike other languages, C++ lets you create objects by value. It also allows for references and pointers, but only use pointers when you …

  4. c++ - Creating an object: with or without `new` - Stack Overflow

    149 Both do different things. The first creates an object with automatic storage duration. It is created, used, and then goes out of scope when the current block ({ ... }) ends. It's the …

  5. c++ - How to create class objects dynamically? - Stack Overflow

    Oct 24, 2010 · Let's say I have a class box, and a user can create boxes. How to do it? I understand I create objects by className objectName(args); but how to do it dynamically, …

  6. c++ - Object creation on the stack/heap? - Stack Overflow

    Apr 15, 2012 · Object o; creates one of the following, depending on its context: a local variable with automatic storage, a static variable at namespace or file scope, a member variable that …

  7. C++ pointer to objects - Stack Overflow

    Jun 7, 2010 · 42 In C++ do you always have to initialize a pointer to an object with the new keyword? Or can you just have this too: MyClass *myclass; myclass->DoSomething(); I …

  8. C++ Dynamic Shared Library on Linux - Stack Overflow

    The article I linked to shows how to create a function pointer to an object factory function using dlsym. It doesn't show the syntax for creating and using objects from the library.

  9. c++ - Creating an instance of class - Stack Overflow

    Sep 3, 2012 · When you want to create an object that outlives the current scope. Remember to delete it when you've finished with it, and learn how to use smart pointers to control the lifetime …

  10. constructor - C++:When creating a new objects inside a function …

    Oct 10, 2014 · C++:When creating a new objects inside a function and returning it as result, must I use the new operator to create the object? Asked 11 years, 1 month ago Modified 5 years, 4 …