chipKIT® Development Platform

Inspired by Arduino™

pmodJSTK cpp declaration question

Created Tue, 09 Feb 2016 15:39:28 +0000 by FredCailloux


FredCailloux

Tue, 09 Feb 2016 15:39:28 +0000

Here is a part of example cpp code for the pmodJSTK:

#include "JSTK.h"
extern "C" {    #include <stdint.h>  }
/* Joystick Driver Object Instantiation - Instantiate a single static instance of this object class */
JSTK::JSTK() { }

I am mostly concentrated on the http://www.Cplusplus.com as a learning source for C++ and in there it is shown that a Class definition is first defined in the header file (which is the case for this pmodJSTK example). It is also though that a Class::Class line does not require to be redefined in it's .cpp code definition if no initiation actions are required. Question: The code above show clearly the JSTK::JSTK() { } line and no further actions are programmed. Why is this line of code present ? What does it do ? Could it be omitted ?

Thanks for your input


majenko

Tue, 09 Feb 2016 18:58:05 +0000

It's probably there because it was automatically put in by a class constructor plugin for an IDE, or because the author does it automatically without thinking.

If you don't explicitly create an empty constructor like that then one is created for you.