Understanding c++ block of code

Posted by kotoko on Stack Overflow See other posts from Stack Overflow or by kotoko
Published on 2012-03-29T23:16:38Z Indexed on 2012/03/29 23:29 UTC
Read the original article Hit count: 176

Filed under:

I was given a c++ main and have to code it so it works.

I am having some trouble understanding the code as I am a bit new to cpp.

Here is the code

int main(int argc, char *argv[]) {
  Class::setAtribute("string"); 
  Class(Class::CONSTANT) << "starting up..."; 
}

Some questions:

  1. How can the first line work with no variables? Is it static?

  2. The second line is really strange for me, what I can make out is a Constructor that takes in a class constante and then prints it out somehow?

    If someone could explain me this bit of code it would be great!

    Thanks in advance.

© Stack Overflow or respective owner

Related posts about c++