Thursday 15 September 2011

c++ - "Does not name a type" error in class -


I am writing a program for my class that includes using a square inside the straight. When the structure (name polynomial) defines 'polynomial is not a type of name' it triggers the first line of the default constructor:

  polynomial :: polynomial () {coefs = vector & Lt; Fraction> (); }  

An error occurs especially on "polynomial :: polynomial () {" line.

For this error, I have found that in all other instances, under class B, class code B is declared using Class B. The only member of the polynomial is a vector of class fractions. I have announced the classes ahead of the classes and the vector is included. This is probably a fraudulent mistake because I'm still very new to C ++ classes (this is my first one) so that any help would be appreciated.

Polynomial header file is the relevant part of:

  // data member vector & lt; Fraction & gt; Coefs; // method polynomial () = default;  

polynomial.cpp to include this header Required:

  #include "polynomial.h"  

between source (.cpp file) and header (.h) file in C ++ There is no implied relationship. You need to include a header for the name polynomial to understand.


No comments:

Post a Comment