![]() |
|
#1
|
|||
|
|||
Why is this variable undeclared?I'm just wondering why I get an error when compiling this code?
rational.h CPP / C++ / C Code:
rational.cpp CPP / C++ / C Code:
Error: Code:
Not sure why it can't find the num and den that I declared in the header file? Thanks |
|||
|
#2
|
|||
|
|||
Re: Why is this variable undeclared?The friend method operator>>() is not a member method so it is not part of an object. It can, however, access r.num.
|
|
#3
|
|||
|
|||
Re: Why is this variable undeclared?I believe your problem is you are bringing in r as an object so you need to use r.num.
|
|
#4
|
|||
|
|||
Re: Why is this variable undeclared?Quote:
This was exactly the problem. Thankyou |
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Flex and bison coding | lucky88star | C++ Forum | 5 | 24-Dec-2007 12:57 |
| Global variable goes out of scope. | Fermat | C++ Forum | 1 | 16-Apr-2007 20:41 |
| [Tutorial] Pointers in C (Part II) | Stack Overflow | C Programming Language | 0 | 27-Apr-2005 18:36 |
| [Tutorial] Pointers in C (Part I) | Stack Overflow | C Programming Language | 1 | 08-Apr-2005 19:35 |
| Can enum have same name as class? | crystalattice | C++ Forum | 3 | 08-Dec-2004 17:43 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The