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. How can i design, To calculate's the objects in a class

How can i design, To calculate's the objects in a class

Scheduled Pinned Locked Moved C / C++ / MFC
helpdesignquestion
3 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.
  • P Offline
    P Offline
    premkamalg
    wrote on last edited by
    #1

    Hai, plz help me , 1) i want to design a program that should calculate's the objects in a class. in which way i design that problem . plz help -- modified at 5:21 Monday 14th August, 2006

    Hi, Thanks, if u think it's good. otherwise sorry.

    M 1 Reply Last reply
    0
    • P premkamalg

      Hai, plz help me , 1) i want to design a program that should calculate's the objects in a class. in which way i design that problem . plz help -- modified at 5:21 Monday 14th August, 2006

      Hi, Thanks, if u think it's good. otherwise sorry.

      M Offline
      M Offline
      Milton Karimbekallil
      wrote on last edited by
      #2

      U r looking for objects in a class or objects of a class? If it is the later, ie how to track the the number of objects created for a class, u can use below demo. class InstanceCntDemo{ private : static int nCnt; public: InstanceCntDemo(){ nCnt++; } static int GetCnt() { return nCnt; } }; int InstanceCntDemo::nCnt =0; int main(){ InstanceCntDemo ic; InstanceCntDemo ic1; InstanceCntDemo ic2; InstanceCntDemo ic3; int nCnt = InstanceCntDemo::GetCnt(); }; Does this make sense? Cheers MiltonKB.

      P 1 Reply Last reply
      0
      • M Milton Karimbekallil

        U r looking for objects in a class or objects of a class? If it is the later, ie how to track the the number of objects created for a class, u can use below demo. class InstanceCntDemo{ private : static int nCnt; public: InstanceCntDemo(){ nCnt++; } static int GetCnt() { return nCnt; } }; int InstanceCntDemo::nCnt =0; int main(){ InstanceCntDemo ic; InstanceCntDemo ic1; InstanceCntDemo ic2; InstanceCntDemo ic3; int nCnt = InstanceCntDemo::GetCnt(); }; Does this make sense? Cheers MiltonKB.

        P Offline
        P Offline
        premkamalg
        wrote on last edited by
        #3

        Thanks Mr.MiltonKB.

        Hi, Thanks, if u think it's good. otherwise sorry.

        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