Question about class member function initialization...
Oct 17, 2016 at 6:15pm UTC
Hello,
I have been getting the below error from my code.
1 2
PowerFlow_SecondAttempt.cpp:49:2: warning: no newline at end of file
PowerFlow_SecondAttempt.cpp:22: error: no 'void line::ConstructLine(double, double, double, double)' member function declared in class 'line'
I don't know why compiler is giving me this error as it seems to me that the member function is defined properly.
Any help that anyone can provided would be greatly appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
#include <iostream>
/* */
//using namespace std;
/* */
//=========================================================================================================================================
// LINE CLASS
//=========================================================================================================================================
class line{
public :
void ConstrucLine(double dLength, double dTolerance, double dConductance, double dSucseptance);
void CreateComplexLineImpedance(double I, double R);
double PrintReal();
double PrintImaginary();
private :
double dLineSusceptance;
double dLineConductance;
double dResistance;
double dReactance;
double dLineLenth;
double dLineTolerance;
};
void line::ConstructLine(double dLength, double dTolerance, double dConductance, double dSucseptance){
dConductance = 1 / dResistance;
dSucseptance = 1 / dReactance;
dLineTolerance = dLineTolerance;
dLineLenth = dLength;}
void line::CreateComplexLineImpedance(double I, double R){
dResistance = I;
dReactance = R;}
double line::PrintReal(){
return dResistance;}
double line::PrintImaginary(){
return dReactance;}
//=========================================================================================================================================
// BUS CLASS
//=========================================================================================================================================
class bus{
public :
private :};
int main(){
line Z;
Z.ConstrucLine(243.4, 567.8, 0.123, 1.234);
std::cout << "==============================================" << std::endl;
std::cout << " The Line Impedance is... " << std::endl;
std::cout << "\n\n\n " << Z.PrintReal() << " + i" << Z.PrintImaginary() << std::endl;
std::cout << "\n\n\n" << std::endl;
std::cout << "==============================================" << std::endl;
return 0;
}
Oct 17, 2016 at 6:29pm UTC
You misspelled ConstructLine on line 10.
Oct 18, 2016 at 10:48pm UTC
Ah, I see that as well as my many mistakes. It works now.
Thank you.
Topic archived. No new replies allowed.