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

Author Topic: so many things i dont understand ...  (Read 2827 times)

0 Members and 3 Guests are viewing this topic.

ravenheart

  • Full Member
  • ***
  • Posts: 148
    • View Profile
so many things i dont understand ...
« on: October 02, 2008, 08:47:36 pm »
Code: [Select]
class MyPicture
{
public :

    // This is the copy constructor
    MyPicture(const MyPicture& Copy) : Image(Copy.Image), Sprite(Copy.Sprite)
    {
        // This is the trick : we setup the sprite
        // to use our image, instead of the one of Copy
        Sprite.SetImage(Image);
    }

    // ... a lot of useful functions ...

private :

    sf::Image  Image;
    sf::Sprite Sprite;
};


how can a normal instance be created? for me it seems that the creation of MyPicture requires an instance of MyPicture?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
so many things i dont understand ...
« Reply #1 on: October 02, 2008, 08:52:47 pm »
This is not a complete class, there's just the tricky part i.e. the copy constructor.

Of course you have to add your own constructors and functions.

Quote
so many things i dont understand ...

Perhaps you first need to read some good tutorial or book about C++ ?
Laurent Gomila - SFML developer

ravenheart

  • Full Member
  • ***
  • Posts: 148
    • View Profile
so many things i dont understand ...
« Reply #2 on: October 02, 2008, 10:30:22 pm »
Quote
Perhaps you first need to read some good tutorial or book about C++ ?


well i did some tutorials and i have read some books (4 of them are mine)
but somehow i believe their niveau is just to low xD

as u surely have seen some of my questions are just about c++
and not bout sfml what they should be
but nevertheless i hope i can stillask u if i have problems

( to outpoint it, for example i never heard of stringstreams before, and in none of my books they are mentioned, only fstreams in a two pages chapter, but i needed them and ure help and the easy usage of sfml (( i tried to do some projects using DX 9 - so i know that sfml is VERY easy - good job)) have helped me to find the motivation and possibility to do my first acceptable results)
if u have a good book for me ( it shouldnt begin with "what is c++" but it shouldnt start with networkprogramming) i am open for every good advice

MrQuizzles

  • Newbie
  • *
  • Posts: 15
    • View Profile
so many things i dont understand ...
« Reply #3 on: October 03, 2008, 12:10:09 am »
My preferred book for learning C++ is Walter Savitch's "Problem Solving in C++: The object of programming"

I got it as a textbook for a class and have since made my way through the whole book in my spare time. It starts with the very basics and makes its way into advanced object-oriented concepts. Pretty much everything I know about C++ I've learned from this book.

Whether you need help with using strings, creating linked lists or working with virtual functions, this book covers it. It is quite simply an excellent book. I keep it around and reference it often whenever I need to.