Returning user defined data types 
Author Message
 Returning user defined data types

Hello,

I'm new to atl programming but I need to develop a component which
encapsulates a neural network which is part of a c++-dll. Because it
is not possible to use objects derived from a dll in matlab, I have to
create a com-object that wraps the objects (com-objects can be easily
used in matlab).

Until now I have developed the 'main' component that holds the
complete net. So far everything works fine. But I also want to access
single nodes. Therefore I created a new atl object to handle single
nodes of the net. Unfortunately I can't instantiate these objects. A
statement like

  CCBiasedNeuronCtl *tmp = new CCBiasedNeuronCtl()

gives the following compiler error (v++.net):
  d:\users\matthias\projekte\wnetapps\ctlWaveletNet\WaveletNetCtl.cpp(37):
error C2259: 'CCBiasedNeuronCtl' : cannot instantiate abstract class
due to following members:

But no members are listed. The only method I added is not abstract.

Thanks in advance
    Matthias



Fri, 29 Apr 2005 22:36:29 GMT  
 Returning user defined data types

Quote:
> Unfortunately I can't instantiate these objects. A
> statement like

>   CCBiasedNeuronCtl *tmp = new CCBiasedNeuronCtl()

> gives the following compiler error (v++.net):

d:\users\matthias\projekte\wnetapps\ctlWaveletNet\WaveletNetCtl.cpp(37):

Quote:
> error C2259: 'CCBiasedNeuronCtl' : cannot instantiate abstract class
> due to following members:

You need to wrap your class in an ATL-provided class that implements
IUnknown methods. E.g.

CComObject<CCBiasedNeuronCtl>* pObject;
CComObject<CCBiasedNeuronCtl>::CreateInstance(&pObject);
// Now pObject points to your instance with refcount of 0

--
With best wishes,
    Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken



Sat, 30 Apr 2005 01:05:19 GMT  
 Returning user defined data types

Quote:

>   CCBiasedNeuronCtl *tmp = new CCBiasedNeuronCtl()

> gives the following compiler error (v++.net):
>   d:\users\matthias\projekte\wnetapps\ctlWaveletNet\WaveletNetCtl.cpp(37):
> error C2259: 'CCBiasedNeuronCtl' : cannot instantiate abstract class
> due to following members:

Change this to:

CComObject<CCBiasedNeuronCtl> *tmp;
CComObject<CCBiasedNeuronCtl>::CreateInstance (&tmp);

The CComObject template fills in the missing implementations for you.



Sat, 30 Apr 2005 01:27:59 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Interface returns user defined type???

2. Convert C++ (return type int, long, user-define, etc) function into COM/ATL

3. User Defined Data Types and Pointers

4. HELP! user-defined data types

5. Passing User defined data Type in ATL

6. Returning a user-defined class

7. Use of enums for user defined types

8. User defined types

9. User defined Type in ATL

10. An array of user defined types

11. User Defined Types in Safearrays

12. Passing user defined type var between VB and VC

 

 
Powered by phpBB® Forum Software