C++ compiler error: “return type specification for constructor invalid”

Here’s my code. When compiling all the files I get this error, I am not sure what I am doing wrong. Please advise.

Molecule.cpp:7:34: error: return type specification for constructor invalid

//Sunny Pathak
//Molecule.cpp    
#include <iostream>
#include "Molecule.h"    
using namespace std;

inline void Molecule::Molecule(){
       int count;
       count = 0;
}//end function

bool Molecule::read(){
    cout << "Enter structure: %c\n" << structure << endl;
    cout << "Enter full name: %c\n" << name << endl;
    cout << "Enter weight   : %f\n" << weight << endl;
}//end function


void Molecule::display() const{
    cout << structure << ' ' << name << ' ' << weight << ' ' << endl;
}//end function

Leave a Comment