Hello there, I have to write a program using three classes. One for the input, a second for the transaction, and a third one for the report. Can I write the three class definition in one header file? Can I write the three classes in one .CPP file?
Can I find an example of a program like this on the Internet?Thanks

Yes, you can write all the 3 class definations in one header file and implementation in one source file (in fact, you can write everything in one file as well).

// Class delarations
class A
{
	A();
	~A();
	void MethodOfA();
};

class B
{
	B();
	~B();
	MethodOfB();
};

class C
{
	C();
	~C();
	MethodOfC();
};

// Class Implmentations
A::A()
{
	// A ctor
}

A::~A()
{
	// A ~ctor
}

void A::MethodOfA()
{
	// MethodOfA
}

// ******************
B::B()
{
	// B ctor
}

B::~B()
{
	// B ~ctor
}

void B::MethodOfB()
{
	// MethodOfB
}

// ******************
C::C()
{
	// C ctor
}

C::~C()
{
	// C ~ctor
}

void C::MethodOfC()
{
	// MethodOfC
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.