473,396 Members | 2,029 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,396 software developers and data experts.

Confusing code

Hello all,

I've done C before but no C++. I'm looking at the example BHO at:
http://www.adp-gmbh.ch/win/com/bho.html and I'm a bit confused by some
of the code:

1. class BHO class adpbho : public IObjectWithSite, public IDispatch
{

Why are there two class declarations?

2. adpbho(unsigned long cookie) : m(1), webBrowser_(0),
connectionPointContainer(0), cookie_(cookie), document_(0) {};

I thought : was used to show the class implemented an interface.
What's it doing in the above line??

Thanks

gareth

Feb 19 '07 #1
4 1875
On 19 Feb, 14:31, "gareth" <garethrichardad...@gmail.comwrote:
Hello all,

I've done C before but no C++. I'm looking at the example BHO at:http://www.adp-gmbh.ch/win/com/bho.htmland I'm a bit confused by some
of the code:

1. class BHO class adpbho : public IObjectWithSite, public IDispatch
{

Why are there two class declarations?
What is BHO? Is it a macro or something? Because I can't see any other
way that can be anything other than a syntax error.
2. adpbho(unsigned long cookie) : m(1), webBrowser_(0),
connectionPointContainer(0), cookie_(cookie), document_(0) {};
That's a member initialisation list - the preferred way to initialise
bases and members in a constructor.
http://www.parashift.com/c++-faq-lit....html#faq-10.6

Gavin Deane

Feb 19 '07 #2
gareth wrote:
1. class BHO class adpbho : public IObjectWithSite, public IDispatch
{

Why are there two class declarations?
According to the site, this is code for a Windows DLL? My guess is that this
isn't standard C++. Perhaps it's .NET Managed C++? MS is famous for
altering standards in order to lock users into their products (aka. vendor
lock-in).

--
Chris
Feb 19 '07 #3
On 19 Feb, 15:29, Chris <c...@thisisnotanemailaddress.cawrote:
gareth wrote:
1. class BHO class adpbho : public IObjectWithSite, public IDispatch
{
Why are there two class declarations?

According to the site, this is code for a Windows DLL? My guess is that this
isn't standard C++. Perhaps it's .NET Managed C++? MS is famous for
altering standards in order to lock users into their products (aka. vendor
lock-in).

--
Chris
There's a lot in there that seems to cause problems, even in VS.NET
2003. I think that maybe this isn't proper code, more part pseudo code
or maybe part of a larger project including a lot of macros (like #B,
MB1)

Thanks for your help

Gareth

Feb 19 '07 #4
gareth wrote:
Hello all,

I've done C before but no C++. I'm looking at the example BHO at:
http://www.adp-gmbh.ch/win/com/bho.html and I'm a bit confused by some
of the code:

1. class BHO class adpbho : public IObjectWithSite, public IDispatch
{

Why are there two class declarations?
I think it is just a mistake. Judging by the rest of the code the class
is called adpbho.
>
2. adpbho(unsigned long cookie) : m(1), webBrowser_(0),
connectionPointContainer(0), cookie_(cookie), document_(0) {};

I thought : was used to show the class implemented an interface.
What's it doing in the above line??
You thought wrong. The : (in this case) introduces an initialiser list,
i.e. a list of base classes and data members that are being initialised
when the constructor executes.

john
Feb 19 '07 #5

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

Similar topics

2
by: Marc | last post by:
Hi all, I was using Tkinter.IntVar() to store values from a large list of parts that I pulled from a list. This is the code to initialize the instances: def initVariables(self): self.e =...
4
by: Mark | last post by:
I'm struggling with how to properly name a specific subset of Properties in my classes. An example will illustrate it best. Let's say you have a class named Person with the code below. Each...
2
by: Glenn | last post by:
Hi! I've developed an app that displays multiple textbox and combobox fields (most of which are autopostback) on a form along with a submit button. My users find it confusing when they change...
1
by: Justin Richeson via .NET 247 | last post by:
(Type your message here) Ok...wow...this is really confusing, but I think it's similar towhat I'm trying to do. I'm looking to create a program thatwill search a "plugins" subdirectory (from where...
2
by: d3vkit | last post by:
Okay so I can NOT get my while loop to work. It's the most confusing thing I've ever come across. It was working fine and then suddenly, nothing. No error. The page just dies. I am using PHP5 with...
11
by: !truth | last post by:
Hi, i feel confused about the following program, and it's works to get a pointer-member's address. #define NETDEV_ALIGN 32 #define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) ...
1
by: Nyx18 | last post by:
ok so i got my class to work now im having confusing errors with this: void sort(Student stu, int parameter, int count) { Student temp; bool finished = false; while (!finished) ...
7
by: Andy B | last post by:
I saw this in the set accessor of a property: Set(ByVal value As DataSet) What exactly does the stuff in the () mean? VS complained about it not being there when I took it out not knowing...
7
by: Luna Moon | last post by:
Hi all, I just couldn't get myself clear about the usage of "const" in front of and/or behind variables, pointers, classes, objects and functions... It's too confusing... any good clear...
2
by: new2c | last post by:
Hi - I'm completely new to C and trying to read some code that doesn't make sense to me. For proprietary reasons I can't display the code here but I'll describe it...and list part of it in a generic...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
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...

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.