TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DAN CHAK
from: WIM VELDHUIS
date: 1997-05-13 21:28:00
subject: My queue (1)

Dan Chak wrote in a message to All:
 DC> ----cut--
 DC> // This is "queue.h"
 DC> template 
 DC> class Queue {
 DC> private:
 DC>    Queue();
The ctor is private, so only the member functions can create an instance of 
this class (your first compiler error). Make it public solves the problem.
 DC>    queue* next;
 DC>    static Queue* front;
 DC>    static Queue* back;
 DC>    dataType info;
 DC>    int length;
 DC> public:
 DC>    Enqueue(dataType Element);
 DC>    dataType Dequeue();
 DC>    int length();
 DC>    // template  processAll(int (*func));
 DC>    dataType operator=(dataType op2);
Here you declare the operator= as a member.
 DC> };
 DC> template  operator=(dataType op2) {
 DC>    *this = op2;
 DC> }
But here you do not define it as a member. Try
template 
dataType Queue::operator=(dataType op2) {
  return *this = op2;
}
By the way, your definition of the assignment operator is exactly the same as 
the default one.
mvg/wr
  
--- timEd/2 1.01.g3+
---------------
* Origin: LightHouse BBS ==> I am a H.U.G.O. Member ! (2:285/324.3)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.