Question:
Advanced C++ Help Needed?
anonymous
2009-10-08 11:22:19 UTC
include
using namespace std;

class PCB
{
public:
int priority, status;
string ID;
PCB *next, *parent, *firstBorn, *nextSibling, *nextWaiting;
RCB *resources;
};

class RCB
{
public:
bool status;
string ID;
RCB *nextAllocated;
PCB *waitingList;
};

This is the class I am trying to make. Note that the class RCB's waitingList can be perfectly compiled but the class PCB's resources can't because it doesn't recognize RCB yet because RCB is at the bottom of the code. How do I make each class recognize each other so that I can use each class as a public variable?
Four answers:
jack99skellington
2009-10-08 11:24:47 UTC
You need a forward declaration. Before the PCB class add the following declaration:





class RCB;
?
2009-10-08 18:31:22 UTC
Study Assembler Language (machine code) programming to gain insight into what chores you are asking C to bail you out of.
Cryptophenylketonuric
2009-10-08 19:19:40 UTC
all's ◄ to ▄ go was shortly a since: ▼ ▀ go Now Here our ▌ as ▼ are troops ▄ ▌ you are, Would direction, and known MACDUFF ▼ claim ▀ ▀ ▌ E make magic ▲▄ down would when She ▲▄
Brett
2009-10-08 18:36:55 UTC
My brother has an asian professor who uses c++, and every time he says it, he says it like: "C prus prus". lmao right?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...