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

Author Topic: Class uses RenderWindow but can't use base constructor?  (Read 6694 times)

0 Members and 2 Guests are viewing this topic.

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
Class uses RenderWindow but can't use base constructor?
« Reply #15 on: August 18, 2011, 05:01:49 am »
The single colon indicates the start of the initialiser list. Like so:

Constructorname(parameters) : namespace::baseConstrustorname(baseconstructorParameters)
{
     body
}

the syntax is similar to how you declare an inherited class:
classname : public baseclass

But they only work for constructors, base constructors and member variables.

What you're doing is passing your argument title, to the normal RenderWindow constructor, that way all the data that Renderwindow normally takes care of(which you also inherited) is still initialised properly.

Look up "initialiser lists" for more info, you can do other stuff with them as well, such as initialising variables more efficiently.

KasHKoW

  • Newbie
  • *
  • Posts: 41
    • View Profile
Class uses RenderWindow but can't use base constructor?
« Reply #16 on: August 20, 2011, 03:12:39 am »
Wow, that's really cool. I finally got my own constructor working and it gives me a seg fault. Run it through gdb but at the same time just try that one.