473,395 Members | 1,987 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,395 software developers and data experts.

Declaring only public class members - doesn't work

Hi all,

I was writing some C++ class stuff in VC. After adding a strcpy(),
whenever the program is exiting I receive a "Unhandled exception: user
breakpoint". Growl, I traced assembly line by line, spend one night
wondering why my strcpy() is overwriting data space. But I couldn't
find anything!

When I replace a header file which exports the class declaration as

class xxx{
public:
xxx
}

with the whole declaration

class xxx{
public:
protected:
private:
}

everything falls in place. Big Oops!

So I gather we are not allowed to declare just the public members when
exporting? Are there any other ways to hide private declarations?

Thanks a bunch!
Jul 22 '05 #1
4 1775
"Chee Liang" <ch*******@DIESPAM.iname.com> wrote in message
news:a7********************************@4ax.com...
Hi all,

I was writing some C++ class stuff in VC. After adding a strcpy(),
whenever the program is exiting I receive a "Unhandled exception: user
breakpoint". Growl, I traced assembly line by line, spend one night
wondering why my strcpy() is overwriting data space. But I couldn't
find anything!

When I replace a header file which exports the class declaration as

class xxx{
public:
xxx
}

with the whole declaration

class xxx{
public:
protected:
private:
}

everything falls in place. Big Oops!

So I gather we are not allowed to declare just the public members when
exporting?
You can declare everything public if you want. Your problem lies elsewhere.
Are there any other ways to hide private declarations?

Thanks a bunch!


I can't tell what is wrong from what you have posted. I suggest you start
paring down the code to the minimum number of lines that cause your problem.
If it isn't obvious by then what your problem is, post what you have and I'm
sure the regulars here will try to help you.

--
Cy
http://home.rochester.rr.com/cyhome/
Jul 22 '05 #2
Chee Liang wrote:
I was writing some C++ class stuff in VC. After adding a strcpy(),
whenever the program is exiting I receive a "Unhandled exception: user
breakpoint". Growl, I traced assembly line by line, spend one night
wondering why my strcpy() is overwriting data space. But I couldn't
find anything!


Very doubtful that the access specifier has anything to do w/ it.

Take a very good look at your strcpy code, you are probably overwriting the
bounds of the destination string here (or in some other location).
Jul 22 '05 #3
ak
On Mon, 12 Apr 2004 11:34:17 +0800, Chee Liang <ch*******@DIESPAM.iname.com>
wrote:
Hi all,

I was writing some C++ class stuff in VC. After adding a strcpy(),
whenever the program is exiting I receive a "Unhandled exception: user
breakpoint". Growl, I traced assembly line by line, spend one night
wondering why my strcpy() is overwriting data space. But I couldn't
find anything!

When I replace a header file which exports the class declaration as

class xxx{
public:
xxx
}

with the whole declaration

class xxx{
public:
protected:
private:
}

everything falls in place. Big Oops!

So I gather we are not allowed to declare just the public members when
exporting? Are there any other ways to hide private declarations?

Thanks a bunch!


sounds to me that you got another problem on your hands
a memory overwrite can cause all kinds of strange behavior.

maybe if u post a bit more code we could have a look.

btw strcpy isnt c++, check out the string class instead.

/ak
Jul 22 '05 #4
ak <ak@workmail <dot>com> spoke thus:
btw strcpy isnt c++, check out the string class instead.

^^^^
It certainly is, althoug not the C++ that most people will find a use
for given the utility of std::string's.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Jul 22 '05 #5

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

Similar topics

2
by: Chee Liang | last post by:
Hi all, I was writing some C++ class stuff in VC. After adding a strcpy(), whenever the program is exiting I receive a "Unhandled exception: user breakpoint". Growl, I traced assembly line by...
14
by: lutorm | last post by:
Hi, I'm having a problem with a return statement being parsed to return a function (I think). Check here: template <typename T> class A {}; template <typename T> class maker_of_A { public:...
13
by: Adam H. Peterson | last post by:
I just made an observation and I wondered if it's generally known (or if I'm missing something). My observation is that static protected members are essentially useless, only a hint to the user. ...
4
by: C-Sharper or C-Hasher, one of the two | last post by:
Hi, I have a C# class libary (Class1) which is inherited by another class in a Windows Forms app. I want this other class to implement some, but not all of the features of the base class. How...
20
by: Ole Hanson | last post by:
I am accessing my database through an interface, to allow future substitution of the physical datastore - hence I would like to declare in my Interface that my DAL-objects implementing the...
8
by: alternativa | last post by:
Hi, what would you say - which way of building a class is better? Why? /**** 1 ****/ class Person { public: Person(char *n, char *sn, int d); ~Person(); protected: char *name;
5
by: Paul | last post by:
Hello All, I am new to C# and dot NET in general. The book I am reading uses the term "non-public." I suspect that they don't mean "private", otherwise they would have said so. What is the...
11
by: Jim Michaels | last post by:
friend fraction& operator+=(const fraction& rhs); fraction.h(64) Error: error: 'fraction& operator+=(const fraction&)' must take exactly two arguments I practically pulled this out of a C++...
17
by: iesvs | last post by:
Hello, i want to create c++ libraries (for my use) but I don't know how I must do to have headers which contain only the public declarations. I used in C to put the private declarations in *.c...
1
by: JavaJon | last post by:
Hello, I'm Jon. I've recently picked up Java after using a "gimmick" programming language called GML ( Game Maker Language ). I've read a lot of tutorials and even a Java for Dummies *.pdf book....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.