Using a smart pointer for all objects

This is a discussion on Using a smart pointer for all objects within the C++ Programming forums, part of the General Programming Boards category; Hi all, I would like to use smart pointers for all objects created on the heap. Following is where my ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    1

    Using a smart pointer for all objects

    Hi all,

    I would like to use smart pointers for all objects created on the heap. Following is where my thoughts are:

    1- Create a RootObject template class that all classes in the System must inherit from.

    2- Overload 'new' operator in RootObject to always return a smart pointer.

    Am I on the right track here? Is this even possible? If not, please advise?

    Thanks.

    phalc

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  2. Compiler "Warnings"
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 04-24-2005, 01:09 PM
  3. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 08:32 AM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM
  5. Determining the number of objects allocated to a pointer...
    By roktsyntst in forum C++ Programming
    Replies: 1
    Last Post: 04-15-2003, 06:08 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21