Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

leileicats

@leileicats
About
Posts
1
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Questions about creating a 3D array class
    L leileicats

    I am doing one project in the book "Data Structures and Algorithms with Object-Oriented Design Patterns in C++". The project is designing a 3D array class based on previous 2D array class. Code as follows: template class Array2D { public: Array2D(int w, int h):width(w), height(h), array(w*h) {} ... ... protected: int width, height; Array array; } template class Array3D { public: Array3D(int l, int w, int h):length(l), width(w), height(h), array(l) {} ... ... protected: int length, width, height; Array< Array2D > array; } I am planning to create a array with elements of 2D array. I could use the initializer "array(l)" to define the length of array. But the size of element "Array2D" should be "width*height". But I don't know how to initialize the size of "Array2D" in the class of Array3D. Could anybody give me some advice please?

    C / C++ / MFC c++ design data-structures tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups