Re: Advice needed for converting MFC to Euphoria

new topic     » goto parent     » topic index » view thread      » older message » newer message

>class camera
>{
>public:
>  camera();
>  virtual ~camera();
>  int  init(DWORD object_to_chase);
>  void move(void);
>  void zoom_out(void);
>  void zoom_in(void);
>  void    set_chase_flexible_mode(void);
>  void    set_chase_location_mode(void);
>  void stop_chasing(void);
>  void update_chase_params(void);
>  DWORD m_camera_handle;
>
>private:
>  DWORD m_object_to_chase;
>
>};
>
>and lines like these in the main program....
>
>camera1->set_chase_flexible_mode();
>
>
>Is camera1 a pointer to an instance of a structure of type camera? (did
>that make any sense?)
>

Almost. It's a pointer to an instance of an camera-class *object*.


>Does "camera1->set_chase_flexible_mode();" call the function and then
>somehow fill in an
>element in the structure? But how if "set_chase_flexible_mode" is a "void"
>function??
>



>What are all those functions / procedures doing in there?
>

An object's functions (also known as mehods) are there to do operations on
that same object's data.

Stupid example:

class person
{
public:
  person();         //constructor (called when "new" is invoked)
  virtual ~person;  //destructor (called when "delete" is invoked)
  void set_first(char *first);
  int get_age();
private:
  char first;
  int age;
};

And of cource you'd have to write the functions you declared, wich is done
inside of the class-definition (?).

Let P be an instance of person, then you could do something like this:

i = 0;             //ERROR! age is a private matter :)
i = P::get_age();  // ask politely..
P::set_first("Bubba");

etc.

I hope this was right. I've done some reading on OOP earlier on, though I've
never practiced it..



_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at
http://profiles.msn.com.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu