Main Menu


Sponsored Links

  


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

Objects as Function Parameters

You probably noticed that internal WCM objects look pretty much like variables. You'll get more familiar with them later after reading about classes. For now I just want to note one simple thing about these objects. You can use these objects as parameters to your functions. You just need to add a special symbol & before a parameter name. For example you can write a function which makes a Boy character to do some actions like this:

#include <boy.h>


void DoActions ( Boy &Who )

{

Who.Says ( "Hello" );

Sleep ( 0.5 );

Who.Winks ();

}


void Scene1 ()

{

Boy Max;

Max.SetVisible ();

DoActions ( Max );

}

Please note that you need to use & symbol, also called ampersand only in function declaration. You do not need to use this symbol in function calls or when using parameter in a function.


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