####short version###
I have a mesh class which contains texture, material, and geometry data, as well as a float, "Bounding Radius".

I am trying to have a class derived from the mesh class called "ObjectType".
I initialize the array like so.
Code:
ObjectType* objectTypes=NULL;
objectTypes=new ObjectType[2];
objectTypes[0]=ObjectType(...arges...);
objectTypes[1]=ObjectType(...arges...);
the constructor ObjectType(...arges...) calls a (non-default) Mesh constructor to init it's mesh member variable. For debugging purposes, I made the default mesh constructor assign bounding radius a value of 5.0, but the non-default constructor, called by assign it a value of 7.0.

But when trying to render the meshes in the array, I get an "Access violation writing location" and the material, texture, and geometry appears uninitialized, even though BoundingRadius is 7.0, indicating that the correct constructor was called and the other data should have been initialized as well.

####long version###
I am making a simple 3d engine with directx.

Basically I have a class, "scenario", which contains inormation on the world (gravity, camera, etc.)and an array of class "ObjectType".
Class "ObjectType contains a member of class "Mesh" and an array of class "Object".
Class "Object" contains transform information for an instance of its parent ObjectType mesh.
class "Mesh" contains materials, textures, and geometry for a directx mesh. It loads this from a directx file.

I tell my scenario to render, which loops through its object types and tells them to render each of their instances. For every element in the instances array, the ObjectType sets the directx world transform matrix to that of corresponding object array element and renders the mesh.

Originally I had implemented all the functionality of class "scenario" directly in the main part of my program, and everything was working fine. For greater data encapsulation I made the 'scenario" class, and now I'm trying to just create an instance of that, and have all the information for my world contained in it. However, I'm running in to problems with uninitialized meshes.

In the main program I have

Code:
Scenario* world=NULL;//global variable
world=new Scenario(...);//I call this after initializing directx. ellipses is the arguments
this constructor for Scenario then calls the following lines of code in its body after initializing "objectTypes", a pointer to an object of class ObjectType, to NULL in the initializer list:

Code:
objectTypes=new ObjectType[2];//supposed to allocate memory for array of ObjectType objects.
I have found that this line calls the default constructor of ObjectType 2 times (each of which also calls the default constructor for Mesh).
(in the call stack, the default constructor of ObjectType was called by 'eh vector constructor iterator')

Code:
objectTypes[0]=ObjectType(...);//elipses is args telling it what file to load for the mesh and some other stuff
This line calls the correct constructor for ObjectType which in turn calls the correct constructor for Mesh. It then calls the destructor for objectType which calls the destructor for mesh. (I assume it destroys whatever was already in the array, and creates a new object to put in its place, but apparently not in that order)

After this, i would think that everything has been initialized. The main program then goes into the render loop, but when it tries to render the meshes of the ObjectType array it gets the following:

Code:
Unhandled exception at 0x4fe5799b in DXTest.exe: 0xC0000005: Access violation writing location 0xfeeefe9e.
The actual addresses probably aren't important. The line that causes this is
Code:
g_pd3dDevice->SetTexture( 0, g_pMeshTextures[i] );
which is supposed to set directx to use the texture for the mesh. In debug, the geometry,materials,and texture data for the entire mesh appears to be uninitialized, however, another member which i made is initialized with the value that the correct (not default) constructor gave it.

Is this a problem with membership copy or something? Should I try making a function ObjectType::set(ObjectType) in which I copy all the data myself?

Thanks for any and all help!