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 2 1753
"Active8" <re*********@nd bbm.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
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 wxScrolledWindo w is not templatized:
template <class T>
class MCCanvas : public wxScrolledWindo w
{
public:
MCCanvas(T* parent, wxPoint& point = wxDefaultSize, wxSize& size =
wxDefaultPositi on);
~MCCanvas(){}
MCCanvas(){}
};
template <class T>
MCCanvas<class T>::MCCanvas(T * parent, wxPoint& point, wxSize& size)
: wxScrolledWindo w( (wxWindow*)pare nt, -1, point, size),
....
{}
Thanks again.
--
Best Regards,
Mike This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 object's members.
now, i have an enclosing class, which has a static factory method (loads
an instance of the enclosing class from a serialized file, and returns
it).
during the loading, some initialization takes place. one of the
initialization...
|
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, while an instance of class C should be able to check all methods
#defined in C, B and A.
#------------------------------------------------
|
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 to turn a previously
made String class that deals with char's into a templated String class
that uses the template parameter C instead of char. I thought it would
be fairly simple to do this exercise, but I encoutered many errors for
my...
|
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 pointer
which points to an instance of a derived class, but when I pass that
base class pointer into a function, it can't access the derived
object's public functions. Although, the base class pointer does call
the appropriate virtual function...
|
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 argument for 'T'"
the infile object is a non-template class with a template function
| |
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 CommonPageBase
- Contains myPage which inherits PageBase
Each of these classes overrides OnInit and ties an event handler
|
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 thawed it out. I built a console app using
Microsoft Visual C++ 6 (VC++) and it worked great. Only one line in the
header file had to be commented out.
I built a console app using Borland C++ Builder 5. The linker complained of
references to...
|
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 magic, I
wrote the following module. It is mainly useful as a light weight tool
to help programmers catch mistakes at definition time (e.g., forgetting
to implement a method required by the given interface). This is handy
when unit tests or...
|
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 do not pose any troubles, but
template based methods.
Let's say this is a header:
class LooseFunctions
{
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |