1. API is clean and improved
2. Performance is greatly improved
3. Value Types need not be boxed when used with List
4. Provides compile time safety
If you upcast, then "new" executes base and "override" executes derived.
Base b = new Derived();
Derived d = new Derived();
b.FooWithNew(); //Base FooWithNew
b.FooWithOverride(); //Derived FooWithOverride
d.FooWithNew(); //Derived FooWithNew
d.FooWithOverride(); //Derived FooWithOverride
In C#, functions are overloads are impemented as "hide by signature", so if base has Foo(int) and Foo(long) and Derived as Foo(int) then Foo(long) from base is not hidden.
Programming is all about knowing when to boil the orange sponge donkey across the phillipines with an orangutang gorilla crossed with a ham sandwich to the fourth power of twelve across the nile with an awful headache from the previous night when all of alfred's naughty jalapeno peppers frog-marched the nordic elves across the loom-lined geronimo induced swamp donkey over and above the fortran fortified kilomanjaro fence past the meticulously crafted anti disgusting sponge cake scenario where all the hats doth quoteth the milk which is not unlike the super werewolf from the infinite realm of ninja-step. it's hard to define, really.
Something I found on a blog.... I don't have any comments for this one...hehe
All I had to do was read some content from Registry, but it was not all that simple, I had to read 1 registry, then use the content to read another string and then use it.
While doing all this, I didn't want to use static size buffers, so I started doing malloc(), but guess what malloc just refused to allocate 104 TCHARs, hmm then I tried HeapAlloc() and that was able to allocate the memory.
Different ways to allocate/de-allocate memory:
| malloc | HeapAlloc | HeapCreate |
| calloc | GlobalAlloc | GetProcessHeap |
| realloc | LocalAlloc | HeapFree |
| new | HeapDestroy | |
| VirtualAlloc |
small amount of memory should be allocated through malloc family. For bigger size user HeapAlloc, GlobalAlloc and LocalAlloc are available only for backward compatibility, so should not be used.
For more detail information on Managing Heap Memory in Win32, refer : http://msdn.microsoft.com/en-us/library/ms810603.aspx