Register    Login    Forum    Search    FAQ

Board index » Everything




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post Posted: October 7th, 2017, 8:38 am 
 

Joined: October 7th, 2017, 8:32 am
Posts: 5
Hi guys! I've been watching "Beginner C++ Game" tutorials for some time now and i've got a question about classes. So, when we want to call a function from let's say "Graphics" class, inside ComposeFrame() for example, what's the difference between "gfx.PutPixel()" and "Graphics::PutPixel()" ?


Top 
 Profile  
Reply with quote  
 Post Posted: October 7th, 2017, 8:53 am 
Site Admin
User avatar

Joined: December 31st, 2011, 4:53 pm
Posts: 3448
Location: Japan
Graphics::Func() works only for static functions--functions that are part of the class but do not operate on an object of the class. gfx.Func() is used to call (or invoke) a non-static member-function on a particular instance of the class (an object of the class).

(The gfx.Func() syntax can be used for static functions as well, but the gfx. part is meaningless and it is exactly the same as Graphics::Func())

_________________
Chili


Top 
 Profile  
Reply with quote  
 Post Posted: October 8th, 2017, 5:39 am 
 

Joined: October 7th, 2017, 8:32 am
Posts: 5
chili wrote:
Graphics::Func() works only for static functions--functions that are part of the class but do not operate on an object of the class. gfx.Func() is used to call (or invoke) a non-static member-function on a particular instance of the class (an object of the class).

(The gfx.Func() syntax can be used for static functions as well, but the gfx. part is meaningless and it is exactly the same as Graphics::Func())


I see...Thanks for the reply Chili :=) Keep doing what you're doing!


Top 
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
 
Post new topic Reply to topic  [ 3 posts ] 

Board index » Everything


 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron