Main Menu


Sponsored Links

  


  
  
Web Cartoon Maker: a Fun Way to Learn C++ Contents Previous Next

Initialize or Construct

Earlier we declared and initialized a Point object using squiggly-braces:

Point MyPoint = { 3.0, 4.0 };

Now, using constructors , we have a different way to declare and initialize:

Point MyPoint ( 3.0, 4.0 );

These two functions represent different programming styles, and different points in the history of C++. Maybe for that reason, the C++ compiler requires that you use one or the other, and not both in the same program.

If you define a constructor for a structur e, then you have to use the constructor to initialize all new structures of that type. The alternate syntax using squiggly-braces is no longer allowed. Initializing using squiggly-braces is an older style of programming and is rarely used now. Please consider to use constructors for the most cases.


Contents Previous Next
  
News

New Tales Animator Video by Alan Sturgess

Alan Sturgess shared an excellent video he made using Tales Animator! You can still download Tales Animator here. Unfortunately it is only available for Wi

...

Simple Online Character Designer

There is a prototype of simple online character designer available HERE. It is only a prototype, it does not contain many pieces yet but it can already generat

...

Book is updated

Now our book "Web Cartoon Maker: A Fun Way to Learn C++" is fully in synch with WCM 1.5! It is available for download and online reading HERE.

...

Web Cartoon Maker 1.5 is here!

Web Cartoon Maker 1.5 is finally here! You can download it HERE! Here is what was updated in version 1.5: Web Cartoon Maker Desktop Edition is now fully standal

...

read more news...


Poll