473,566 Members | 3,273 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unnamed "Formal Parameter"

Hi All,
One of the ATL class.....

template <class Base>
class CComObject : public Base
{
public:
typedef Base _BaseClass;
CComObject(void * = NULL)
{
..............
}
:
:
};

Constructor takes parameter "void* = NULL",
how this unnamed parameter to the constructor is used

Thanks and Regards
HoRaNa


Jul 19 '05 #1
3 3054

"Mysooru" <na*******@yaho o.com> wrote in message
news:bf******** **@news.mch.sbs .de...
Hi All,
One of the ATL class.....

template <class Base>
class CComObject : public Base
{
public:
typedef Base _BaseClass;
CComObject(void * = NULL)
{
..............
}
:
:
};

Constructor takes parameter "void* = NULL",
how this unnamed parameter to the constructor is used

Thanks and Regards
HoRaNa


It's not. The parameter is there so that CComObject is compatible with other
classes such as CComPolyObject. Both CComObject, CComPolyObject and others
might be used as parameters to the template CComCreator which assumes that a
constructir which takes one parameter exists.

For instance

class A
{
public:
A(void* = 0) {} // unused parameter
};

class B
{
public:
B(void* p) : pp(p) {} // used parameter
private:
void* pp;
};

template <class T>
class C
{
public:
static T* create(void* p = 0) { return new T(p); }
};

int main()
{
A* a = C<A>::create() ;
B* b = C<B>::create("h ello");
}

C<A>::create would not compile unless A::A had a parameter even though it is
not used.

john
Jul 19 '05 #2
Mysooru <na*******@yaho o.com> wrote in message
news:bf******** **@news.mch.sbs .de...
Hi All,
One of the ATL class.....

template <class Base>
class CComObject : public Base
{
public:
typedef Base _BaseClass;
CComObject(void * = NULL)
{
..............
}
:
:
};

Constructor takes parameter "void* = NULL",
how this unnamed parameter to the constructor is used


It isn't used. Maybe the designers included the pointer for possible use in
a future version that would not require existing code being re-compiled.

DW

Jul 19 '05 #3

Mysooru <na*******@yaho o.com> wrote in message
news:bf******** **@news.mch.sbs .de...
Hi All,
One of the ATL class.....

template <class Base>
class CComObject : public Base
{
public:
typedef Base _BaseClass;
CComObject(void * = NULL)
{
..............
}
:
:
};

Constructor takes parameter "void* = NULL",
how this unnamed parameter to the constructor is used

Thanks and Regards
HoRaNa

Jul 19 '05 #4

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

Similar topics

3
2022
by: Ian Lazarus | last post by:
// why is the error message being generated? // Microsoft Visual C/C++ 5.0 class Bar { public: void Log(const char* p){ } }; class Foo : public Bar
11
2442
by: Florian Loitsch | last post by:
I'm currently writing a JS->Scheme compiler (which, using Bigloo, automatically yields a JS->C, JS->JVM, JS->.NET compiler), and have a question concerning the function-parameters: According to the spec (10.1.6) the activation-object already contains the the parameters-object when the variables are instantiated (10.1.3). The question is now:...
2
2737
by: John A Grandy | last post by:
Is there something special in XML about the name "Parameter" ... I am not able to XPATH query for nodes named "Parameter" <Root> <Category CategoryID="1"> <Elements> <Element ElementID="1"></Element> <Element ElementID="2"></Element> <Element ElementID="3"></Element> </Elements>
1
2266
by: Alex Chan | last post by:
Hi Group, I have written a window service wtih SAP.NET Connector which is to fulfil request from SAP client. SAP client will call a function exposed by my window service that has a big "out" parameter. That "out" parameter is of class SAPTable, you can regard that as DataTable. As everytime SAP client issue request to my window service,...
4
4027
by: Ondrej Spanel | last post by:
The code below does not compile with .NET 2003, I get folowing error: w:\c\Pokusy\delegTemplArg\delegTemplArg.cpp(11) : error C2993: 'float' : illegal type for non-type template parameter 'x' The error shows compiler is quite confused - x is not a template parameter at all. I have found two workarounds, but still I think the code should...
1
2685
by: sd | last post by:
QUESTION: How can my ASP page - which uses language="VBScript" - pass a "System.Collections.ArrayList" object - as a parameter - to a C# method in the middle-tier ??? ----- Is it possible at all? - if not, what work-a-round is there? I have no issues passing "string" parameters successfully to other methods in the same "middle-tier" -...
2
1446
by: Nemisis | last post by:
Hi, Is it possible to pass in an object and parameter into a function and return it as a string. i.e. To make a call to the function i would put the following Dim str as String = MyTestFunction(myObject.Parameter)
4
3276
by: =?utf-8?B?Qm9yaXMgRHXFoWVr?= | last post by:
Hello, what is the use-case of parameter "start" in string's "endswith" method? Consider the following minimal example: a = "testing" suffix="ing" a.endswith(suffix, 2) Significance of "end" is obvious. But not so for "start".
11
4264
by: John Nagle | last post by:
I passed a dict for the "env" variable to Popen with Unicode strings for the dictionary values. Got: File "D:\Python24\lib\subprocess.py", line 706, in _execute_child TypeError: environment can only contain strings It turns out that the strings in the "env" parameter have to be ASCII, not Unicode, even though Windows fully supports...
0
7673
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, 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...
0
7584
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...
0
8109
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5485
isladogs
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...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1202
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
926
bsmnconsultancy
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...

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.