Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » C++   (RSS)

C++: Calling a virtual function from a constructor is not polymorphic

In C++, if you call a virtual function form a constructor, it won’t be polymorphic, meaning that the following code won’t behave as you may have expected: class   Foo   { public :     Foo()   {        
Posted by mohamedg | 1 Comments
Filed under: ,

Passing C++ Arrays by Value

Just in case you needed to, you can wrap an array into a struct/class and pass it by value to a function: template < typename T, int N> struct array { T value[N]; T & operator []( int i) { return value[i]; } }; template < typename T, int
Posted by mohamedg | 5 Comments
Filed under: ,

Proxy Design Pattern

One of the useful design patterns is the proxy design pattern, it allows you to control access to an object via a proxy and also saves you the startup and cleanup overheads as you instantiate only what you use upon request (lazy initialization). Take
Posted by mohamedg | 0 Comments
Filed under: ,
 
Page view tracker