> I'm currently using your library live555 and I'd like to know for which 
> reason your prefer to use a static "createNew" function for each classes 
> instead of constructors?
> It seems it has been done for a specific reason and I'm interested to know 
> why :)

Yes, this was done to force developers to create these objects on the heap, 
rather than on the stack.

Creating these objects on the heap makes it easy for the class to be subclassed 
later, if you wish.  If the class is later subclassed, then you can create new 
objects of the subclass just by changing the implementation of the 
“createNew()” function - and the rest of the existing code will still work.  
But if the objects were created on the stack, then it would not be possible for 
the class to be later subclassed.

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to