Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualjapro

Posted 20 October 2012 - 02:37 AM

In the pointer case you should initialize the pointer from your main (or a function called from there) and also delete it at the end of the program/deinitialization. The main advantage of the pointer solution is imho that you can control the lifetime of the object and obviously you can also use polymorphism (say if you have RendererOpenGL and RendererD3D or so). Both approaches are valid depending on what you want exactly.
Also if you are not using a pointer you don't actually need the "= Renderer()". Just "Renderer renderer();" is ok.

#2japro

Posted 20 October 2012 - 02:34 AM

In the pointer case you should initialize the pointer from your main (or a function called from there) and also delete it at the end of the program/deinitialization. The main advantage of the pointer solution is imho that you can control the lifetime of the object and obviously you can also use polymorphism (say if you have RendererOpenGL and RendererD3D or so). Both approaches are valid depending on what you want exactly.

#1japro

Posted 20 October 2012 - 02:33 AM

In the pointer case you should initialize the pointer from your main (or a function called from there) and also delete it at the end of the program/deinitialization. The main advantage of the pointer solution is imho that you can control the lifetime of the object and obviously you can also use polymorphism (say if you have RendererOpenGL and RendererD3D or so).

PARTNERS