![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
__gc class
if i create a managed C++ class :
__gc class MyClass string * MyString One more thing on managed c++. Garbage collection happens when a pointer or referenced object "falls out of scope" exactly what does that mean in terms of memory management and when does it occur in a program. thanks .. |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Jul 2006
Location: England
Posts: 43
Rep Power: 0
![]() |
Garbage Collection is where when a object on the heap that no longer has any references to it remaining it is deleted automatically. This avoids the need to manually delete in your code.
There are some verious ways this can be achieved. The most common is where the heap is copied to a new heap and any objects on the heap that have no references remaining will be left behind and so will be removed. There are machanisms to figure out if there is circular references and remove objects that refer to other objects on the heap with no references in the scope of your program. Managed C++ is a dire language and i would keep well away. MS have replaced it with C++/CLI which comes with .net 2.0. Its much improved though i still dont really see the use of it. If you are a C++ developer converting to .net its probably a better idea to go with C# as its the number one language on .net. I have not looked at managed C++ in quite a while so i cant remember the syntax so i will avoid spreading rubbish. If you need C++ for .net use C++/CLI its 10 times better, or use C# which is far far more straight forward. |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Mar 2006
Location: Lebanon
Posts: 148
Rep Power: 3
![]() |
hey thanks for the helpfull feedback on garbage collection JimmyJim ..
I am currently learning c++.net to get into GUI's and connecting to & operating on SQL databses.. But will convert to C#.net next spring.. ![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| URL class | Eric the Red | Java | 5 | Jun 24th, 2006 9:01 PM |
| using classes in another class | ling_wong | C++ | 6 | Jan 23rd, 2006 9:55 PM |
| What is: "Oriented programming (OO)?" | BrinyCode | C++ | 12 | Nov 22nd, 2005 7:40 AM |
| User Input for Number Format | ericelysia1 | Java | 0 | Jul 21st, 2005 3:41 PM |
| MFC/OpenGL: problem with 'Document' class | brenda | C++ | 11 | May 23rd, 2005 8:10 PM |