Search:

Type: Posts; User: isgoed

Search: Search took 0.00 seconds.

  1. Thanks that worked, I only had to put the call...

    Thanks that worked,

    I only had to put the call to the inherited constructor in the function definition and not in the function prototype.
    as:


    class Leaf : public Base
    {
    void *ExtraData;...
  2. Constructor Inheritance with arguments does not allow a body definition

    I want to have a derived class with a custom constructor. What I am trying is this:



    class Base
    {
    protected:
    int Number;
    int MaxMemory;
  3. Replies
    14
    Views
    7,227

    Then why are you replying? Sure, you should do...

    Then why are you replying?

    Sure, you should do error checking. As I've said that malloc could fail. And the code above is just functionality code. Right now the code wouldn't even compile.


    ...
  4. Replies
    14
    Views
    7,227

    Ah, now I see how that's done. I thought that...

    Ah, now I see how that's done. I thought that placement new only had a purpose for memory pools. But of course an array is also a memory pool. So a C++ recommended code would look like this:


    //...
  5. Replies
    14
    Views
    7,227

    Why? Also the article gives not an answer to that...

    Why? Also the article gives not an answer to that question. If you know why things happen, they are no longer "undefined behaviour", so that's how I like to deal with problems. Could it be that this...
  6. Replies
    14
    Views
    7,227

    Well I have come up with a solution: I just...

    Well I have come up with a solution:

    I just don't call new and delete any more, but use my own memory allocation and initialization. You can't invoke a constructor, but you can just use a member...
  7. Replies
    14
    Views
    7,227

    I want to be able to save my objects to disk in a...

    [/QUOTE]I want to be able to save my objects to disk in a way that handles arrays, classes and data uniformly. Since a vector is a struct I have to access the internal pointers of the array. The...
  8. Replies
    14
    Views
    7,227

    resize array of objects

    I want to resize an array of objects. I found an earlier thread which requested the same, where post 14 suggested what to do. I made my custom operator new[] and delete[] as described in the article...
Results 1 to 8 of 8