:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::
Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Wed Aug 21, 2019 4:48 am
All times are UTC + 0
 Forum index » Modding Central » Game Development and Programming Discussion
Newbie C++ question
Moderators: Global Moderators
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Fri Jan 11, 2019 6:27 am    Post subject:  Newbie C++ question Reply with quote

I have a newbie C++ question, I have decided to look into C++ a little more and have found myself a little puzzled about something. I don't even know where to start looking.

This code for example.

Code:

#include <gtkmm.h>

int main(int argc, char* argv[]){

    Gtk::Main kit(argc, argv);
    Gtk::Window window;
    Gtk::Main::run(window);
    return 0;

}


What is the deal with the 'Gtk' and '::'?

I guess Gtk is the object? but I do see what looks like the object is 'window'. I am not wondering about Gtk stands for, or what library it comes from, but why is it there?

And I have no idea what the '::' even does.

What should I be googling for to find out what that syntax is.
_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Joined: 15 Aug 2002
Location: Brazil

PostPosted: Fri Jan 11, 2019 10:45 am    Post subject: Reply with quote

Gtk is a namespace.

Back to top
View user's profile Send private message Visit poster's website Skype Account
cxtian39
Commander


Joined: 11 Feb 2016
Location: United States

PostPosted: Fri Jan 11, 2019 7:23 pm    Post subject: Reply with quote

:: is to access stuff inside namespace & class

Back to top
View user's profile Send private message Skype Account
G-E
General


Joined: 09 Feb 2015

PostPosted: Fri Jan 11, 2019 10:10 pm    Post subject: Reply with quote

Yea you can have nested namespaces to keep the variable names  or functions of the same without interfering. Anything complex that is likely to overlap should probably have its own.
_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Fri Jan 11, 2019 11:30 pm    Post subject: Reply with quote

Interesting, that is very helpful!

C++ has some very different ways to go about things... It kind of seems like I kind of like C#/Java a little better...

Thanks!
_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
 Forum index » Modding Central » Game Development and Programming Discussion
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

Wildcard SSL Certificates
[ Time: 0.1937s ][ Queries: 12 (0.0717s) ][ Debug on ]