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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Spacelord

Pages: [1]
1
General / Re: Question regarding RenderWindow's c-tor
« on: August 30, 2014, 07:29:23 pm »

Got it now; what I was doing basically in the second case is calling a function called window that would return void and not the constructor (http://www.parashift.com/c++-faq/empty-parens-in-object-decl.html).

Thanks for your help Ixrec! :)

2
General / [SOLVED] Question regarding RenderWindow's c-tor
« on: August 30, 2014, 02:06:58 am »
Hello everyone!

A new SFML user here. I was playing around with sf::RenderWindow as a member variable inside a class and noticed something; when I initialize window using init lists, it works:

SharpShooter::SharpShooter() : window(sf::VideoMode(680,480), "Rendering Area") { }

However, if I declare it inside the body of the c-tor like so:

SharpShooter::SharpShooter()  
{
window(sf::VideoMode(680,480), "Rendering Area");
 }

I get the following error;

Quote
error: no match for call to ‘(sf::RenderWindow) (sf::VideoMode, const char [12])’

FYI, window is neither a const member nor a reference.

This is might be more of a C++ question but I was curious and wanted to ask about it

Thanks in advance.

Pages: [1]
anything