|
-
November 6th, 2009, 04:30 PM
#1
Error - Going from Java to C++
I have created a linked list in Java, and now I am trying to convert my program to C++.
When I try to compile, it gives me the error saying that 'next' uses 'CarNode' which is being defined. I am wondering if there is any way around this?
Java:
public class CarNode {
public Car carObject;
public CarNode next;
public CarNode (Car newCar, CarNode newNext) {
carObject = newCar;
next = newNext;
}
}
C++:
class CarNode: public Car {
public:
Car carObject;
CarNode next;
CarNode(Car newCar, CarNode newNext) {
carObject = newCar;
next = newNext;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|