473,668 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

object initialized to zero(not a pure virtual function)

22 New Member
hi
i saw a program which inside its class initializes another class object to zero.
also if i initialize to some other number other than zero ,an error occurs.

Expand|Select|Wrap|Line Numbers
  1. Circle* cp = 0;
this is not related with pure virtual function since it is an object not a function.

can some one could explain what it is.
Dec 26 '07 #1
5 1640
scruggsy
147 New Member
hi
i saw a program which inside its class initializes another class object to zero.
also if i initialize to some other number other than zero ,an error occurs.

Expand|Select|Wrap|Line Numbers
  1. Circle* cp = 0;
this is not related with pure virtual function since it is an object not a function.

can some one could explain what it is.
A pointer with a value of zero is called a null pointer; it means the pointer points to nothing.
In C++ it's more common to use Circle* cp = NULL; to make the intention more clear. Either way, pointers should always be initialized to NULL (or 0); otherwise they may point to garbage and produce difficult-to-find bugs.
Dec 26 '07 #2
babu198649
22 New Member
thanks......... ...........
Dec 26 '07 #3
babu198649
22 New Member
does pointing to 0(NULL) will not point to data in 0th location
Dec 26 '07 #4
weaknessforcats
9,208 Recognized Expert Moderator Expert
Circle* cp = NULL;
This is C. There is no NULL in C++. Use 0.
Dec 26 '07 #5
scruggsy
147 New Member
This is C. There is no NULL in C++. Use 0.
Really? My mistake. Thanks.
In any case, babu, if you try to dereference a pointer with a value of 0, most operating systems generate an exception. If you dereference an uninitialized pointer, on the other hand, the OS can't tell that you've made a mistake, which makes the error much more difficult for you to track down.
Dec 26 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2152
by: satish | last post by:
Hello all, I have a python module generated by SWIG. When I try to import the moduleI get the following error : >>> import overturec Traceback (most recent call last): File "<stdin>", line 1, in ? File "/home/world0/SWIGTEST/overturec.py", line 4, in ? import _overturec
6
1598
by: WindAndWaves | last post by:
Hi Everyone, Here is another question: I run a database in Access RT in a Virtual PC environment. Every now and then I get an error: "Object Not set", which then freezes everything. Not even CTRL + ALT + DELETE can really help. Any idea what I can do to solve this problem???
2
4018
by: Jan Szymczuk | last post by:
I have created an MSAccess 2000 Database that has a couple of OLE Object fields that hold photos and Map locations (which I upload in JPG format), On the form I have the Photo and Map location images control Dislay Type set to Content, on my laptop, when I can see the photo or map location as a thumbnail and simply double click and it is enlarged into a bigger image in my default imaging viewing software (eg., Microsoft Photo Editor), when...
1
2588
by: Roman S. Golubin | last post by:
Hi, I install sqlxml 3.0 SP2. Then I create vDir "service" (with windows auth) and configure the SOAP virtual name "vname". Then I generate a proxy with wsdl.exe tool from http://localhost/service/vname?wsdl. I try to invoke the stored procedure "qq" now and I get the Exception "The request failed with HTTP status 404: Object Not Found." Can anyone help me configure an xslxml or wsdl.exe proxy generator then I stay happy?
2
1056
by: juli jul | last post by:
Hello, I am doing this initialization : this.oXmlDoc=new XmlDocument(); in InitializeComponent() function. And once in a while because of some reason I can't detect this statement is being erased and I get the Object not initialized error. Why is this happens? Thank you!
1
2131
by: aaa | last post by:
I am using a third party provider for Travel related web services. These services are not very well documented and I am having to wing my way thru nearly every one. Some I can pull data from just fine others bomb when assigning criteria to the body of it's request object ("object not set to an instance of an object"). I am essentially creating nodes programatically to buld the XML that gets pumped to the SOAP call. Has anyone run...
0
1930
by: Jagdish | last post by:
Hello, Every body I have recently joined this group and I want to know how to pass Array of string to a Com object function.. Actually I want to pass String array from VB6 to Com Interface Function which is wrriten in VC++ 6. So how can I declare that function and how can I access each string ?? Can anybody help me ?? Thanking you.
0
912
by: kempshall | last post by:
I have a web application that I just migrated from ASP.NET 1.1 to 2.0. My problem is that when I execute the application, the Global constructor and the Global.Application_BeginRequest methods never get called. (The other methods in the Global object might also not get called, but I'm not sure about those.) My 1.1 version of the application works fine, and when I migrated, I used the instructions here...
8
3260
by: webgenius | last post by:
Whenever I click the SUBMIT button in my HTML page, I get the "Object not found!" error. It was working fine yesterday. This error started to occur after I installed Codelobster and made some changes to the php file CheckLogin.php. This is a small part of the HTML page with the button: When I enter the username and password and click on the Submit button, I get the error: Plase help me on this.
0
8371
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,...
0
8790
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8652
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 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...
1
6206
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5677
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.