-
July 31st, 2001, 01:40 PM
#1
Non-default constructor in a COM object - how?
I would like to translate the following class to a COM object:
class MyClass
{
private:
int m_Data;
public:
MyClass(int Data) : m_Data(Data) {}
int Get() { return m_Data; }
};
My question is: How can I translate the parameterized constructor?
-
July 31st, 2001, 01:45 PM
#2
Re: Non-default constructor in a COM object - how?
You can't. COM wasn't built to use C++. It is made easy with C++, but languages such as C, VB, VBSCRIPT, etc... have no knowledge of c++ constructors/destructors. Instead of relying on a parameterized constructor, add an Init function. That the client must call before using any other method.
Got a question? try looking it up in MSDN first. Msdn comes with the Visual Studio, and can be found at http://msdn.microsoft.com
---===---
I'm not here for the rates, but rating a post is a good way for me to know how much i helped.
---===---
Daniel
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|