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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Creation of class members of class created on the heap

Creation of class members of class created on the heap

Scheduled Pinned Locked Moved C / C++ / MFC
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Hi If have a class member say CFont cf; which is a member of My CDialig derived class which I create on the heap via new Does storage for cf get allocated when I do the new for the CDialog derived class Thanks

    L 1 Reply Last reply
    0
    • F ForNow

      Hi If have a class member say CFont cf; which is a member of My CDialig derived class which I create on the heap via new Does storage for cf get allocated when I do the new for the CDialog derived class Thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Yes, storage for class members will be allocated when the object is created. In the case of class objects (such as your CFont object) their constructor will be called to create them. You can see this happen by stepping through the code in the debugger.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

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