473,405 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

temlate class

Maybe it's been so long that I forgot something but I can't remember
the solution to this compiler error:

error C2039: '__ctor' : is not a member of 'GFX<class T>'
error C2935: 'GFX<class T>' : template-class-id redefined as a
global function

gfx.h

#include <canvas.h>

template <class T>
class GFX : public MCCanvas<class T>
{
public:
GFX();
// GFX(T* parent, wxPoint point, wxSize size);
~GFX(){}

private:
};

gfx.cpp

#include "gfx.h"

template <class T>
GFX<class T>::GFX(){}

It does this whether I implement the class in the header or the cpp
file and regardless of whether it's for the default ctor, or
another. MCCanvas is a template class and it compiles fine.

TIA
--
Best Regards,
Mike
Jul 23 '05 #1
2 1738
"Active8" <re*********@ndbbm.net> wrote...
Maybe it's been so long that I forgot something but I can't remember
the solution to this compiler error:

error C2039: '__ctor' : is not a member of 'GFX<class T>'
error C2935: 'GFX<class T>' : template-class-id redefined as a
global function

gfx.h

#include <canvas.h>

template <class T>
class GFX : public MCCanvas<class T>
{
public:
GFX();
// GFX(T* parent, wxPoint point, wxSize size);
~GFX(){}

private:
};

gfx.cpp

#include "gfx.h"

template <class T>
GFX<class T>::GFX(){}

It does this whether I implement the class in the header or the cpp
file and regardless of whether it's for the default ctor, or
another. MCCanvas is a template class and it compiles fine.


It doesn't matter where you put it, the code ends up in a source file
anyway, after you include the "header" file.

Have you tried dropping the second keyword 'class' from the c-tor
definition and also from the declaration of the base class?

template<class T> class GFX : public MCCanvas<T> ...
...
template<class T> GFX<T>::GFX() {}

They are not only superfluous, they are syntax errors, AFAIK.

V
Jul 23 '05 #2
On Mon, 21 Feb 2005 15:38:25 -0500, Victor Bazarov wrote:


Have you tried dropping the second keyword 'class' from the c-tor
definition and also from the declaration of the base class?

template<class T> class GFX : public MCCanvas<T> ...
...
template<class T> GFX<T>::GFX() {}

They are not only superfluous, they are syntax errors, AFAIK.

Ah... I'd dropped one but not the other, thanks. It's goofy because
the code below works just fine. The only diff here is that the base
class wxScrolledWindow is not templatized:

template <class T>
class MCCanvas : public wxScrolledWindow
{
public:
MCCanvas(T* parent, wxPoint& point = wxDefaultSize, wxSize& size =
wxDefaultPosition);
~MCCanvas(){}
MCCanvas(){}
};

template <class T>
MCCanvas<class T>::MCCanvas(T* parent, wxPoint& point, wxSize& size)
: wxScrolledWindow( (wxWindow*)parent, -1, point, size),
....
{}

Thanks again.
--
Best Regards,
Mike
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Murat Tasan | last post by:
hi, i am having a small problem with constructing an inner class. i am using an inner class (and not a static nested class) because the methods of the inner class need access to the enclosing...
2
by: Fernando Rodriguez | last post by:
Hi, I need to traverse the methods defined in a class and its superclasses. This is the code I'm using: # An instance of class B should be able to check all the methods defined in B #and A,...
1
by: Oplec | last post by:
Hi, I'm learning C++ as a hobby using The C++ Programming Language : Special Edition by Bjarne Stroustrup. I'm working on chpater 13 exercises that deal with templates. Exercise 13.9 asks for me...
9
by: Banaticus Bart | last post by:
I wrote an abstract base class from which I've derived a few other classes. I'd like to create a base class array where each element is an instance of a derived object. I can create a base class...
5
by: Active8 | last post by:
vector<double> signal; vector<double>::iterator iter; in_file.load_vector(signal); in_file.load_vector(signal.begin()); those calls give the compiler error: "could not deduce template...
5
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
3
by: Hamilton Woods | last post by:
Diehards, I developed a template matrix class back around 1992 using Borland C++ 4.5 (ancestor of C++ Builder) and haven't touched it until a few days ago. I pulled it from the freezer and...
0
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass...
5
by: pkoniusz | last post by:
Hello everyone. The problem may be obvious, though I'm a bit puzzled by the error LNK2028 when attempting to utilize my static library. The all methods of the class defined within that library...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.