Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: simple question  (Read 3067 times)

0 Members and 1 Guest are viewing this topic.

ravenheart

  • Full Member
  • ***
  • Posts: 148
    • View Profile
simple question
« on: October 01, 2008, 08:43:46 pm »
hmm i dont know what following does mean:


Code: [Select]
MyPicture(const MyPicture& Copy) : Image(Copy.Image), Sprite(Copy.Sprite)

what does ":" effect?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
simple question
« Reply #1 on: October 01, 2008, 08:46:22 pm »
This is the constructor initialization list, which is the place where the class members are constructed.
Laurent Gomila - SFML developer

ravenheart

  • Full Member
  • ***
  • Posts: 148
    • View Profile
simple question
« Reply #2 on: October 01, 2008, 08:50:57 pm »
so in this step not only an instance of MyPicture is created but also its members?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
simple question
« Reply #3 on: October 01, 2008, 08:58:20 pm »
Of course ;)

And they are automatically copied in the class copy constructor, assigned in the class assignment operator, and destructed in the class destructor (unless you provide your own version of these functions).
Laurent Gomila - SFML developer

 

anything