Thanks, Grumpy, I did not know that.
@citizen, this is an "anonymous union", it's working fine for built-in types. And as far as I know, it is legal in C++.
Type: Posts; User: kocika73
Thanks, Grumpy, I did not know that.
@citizen, this is an "anonymous union", it's working fine for built-in types. And as far as I know, it is legal in C++.
I wrot e a template which successfully works for ints, floats, doubles etc. It includes a method which does a swap between two members of the class.
For example:
the class decl.
template<...
Oh....... Thanks Daved. I knew it is something so trivial...
I get an error:
which I really do not understand... I only suspect there is something wrong with the default constructor, but I have no clue what.
I have my template in .h file (all declarations...
Thanks Salem. Client is on Red Hat 7.2, but server is on SunOS 5.10 if I remember correctly the version number. Would it make a difference?
That's not what I meant. Thanks anyway.
I have no problems with files manipulation in C. My question is what I need to write to a log file of that type and if fprintf is what I'm looking for. The...
I do not even know where to start. How do I create a log file where after executing some client-server communication user can read what kind of info exchange was performed. I'm writing this in C....
Thanks, ChaosEngine! I'll try and see what I can do with it!
Thanks Tonto, I'll think about it!
Can anybody explain to me what is going on below?
class A {
public:
A(int i) {}
};
class B {
char* myString;
Life would much easier if I could use string, but I have to use NTS instead... And I do not know anything about vectors yet... Thanks, but that will not solve my problem.......
The whole trouble is...
Thanks! Oh...... That's why it was showing ONLY when in MyString class.......
But how do I indicate that I want "name" to act in People class as MyString constructor?
OK, I made some changes...
class People {
private:
int age;
MyString name;
MyString address;
public:
People() {
Yes, displays fine....
All of the constructors ask for data from keyboard, either all of it, or some part is given, like age.
Hi, all. I was working on this and I thought I finally figured it out but when I ran this program what it did is to output blank lines. This is confusing...
OK, so I got a class called MyString...
no. Should I?
-----------
Well, I tried that too. It compiles fine, but when I run the program it displays a blank line where the MyString vars (from People class) should go.
I tried to do...
Maybe I am doing that wrong, but now the compiler lists << as no match again...
What I was thinking, maybe it has a problem with the return type of getName() and getAddress()...... It is MyString. ...
I wrote a class called MyString. It uses NTS string, c-style. Basically consists of constructors, copy constructor and destructor. Nothing else.
I also wrote another class, called People.
...
It is Object-Oriented Programming in C++ by Johnsonbaugh and Kalin. Example 3.7.4 on p. 154 (the top of page. Later they modify that without explaining why they leave out the "const")
So the book is wrong then.
OK... that sounds reasonable. Does most of compliers give errors at this point? Or is it only Dev?
I'm working on this program and is such a slow progress, I keep stumbling on so small things... Like this one. My textbook is showing a class with private static int, and a public static method which...
Pheeew. That's a relief. :D Thanks a lot guys!
Well, it is just an assignment and I am supposed to know how to access certain members and whether I can at all. Just an exercise.
Thanks.
I've been searching for an answer here on the board about destructors. I found this
Is that a reason why my destructors are called twice?
I have a base class and a derived class. I construct 3...