samedi 26 août 2017

How to initialize static class objects in c++?

Lane.h

class Lane{
    //other declarations..
public:
    Lane(){}
    static Lane left_line;
    static Lane right_line;
};

Lane.cpp

Lane Lane::left_line;

main.cpp

int main(){
    Lane::left_line();  //doesn't work

What am I doing wrong or am I doing everything wrong. I am actually confused about how the static objects work exactly.

Aucun commentaire:

Enregistrer un commentaire