473,508 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bruno Preiss Book base Object implementation problem

6 New Member
Hello all,

Data Structures and Algorithms with Object-Oriented Design Patterns in C++ - author Bruno Preiss

Does anyone know of/have a solutions manual to the book above ?

The particular problem I'm having is in Data Types and Abstraction chapter implementing the Object class.

Thanks in advance.
Nov 12 '07 #1
4 1404
RedSon
5,000 Recognized Expert Expert
Hello all,

Data Structures and Algorithms with Object-Oriented Design Patterns in C++ - author Bruno Preiss

Does anyone know of/have a solutions manual to the book above ?

The particular problem I'm having is in Data Types and Abstraction chapter implementing the Object class.

Thanks in advance.
The book's website should be able to tell you that better then us. If you want help with your homework, there are plenty of nice people who will lend you a hand or give you hints for a tricky part. No one here is going to do your homework for you but everyone needs help now and again. So ask you question if you got it. And, welcome to thescripts.

testlink
Nov 12 '07 #2
entellus
6 New Member
thanks for the response. i'll just be more specific.

error: 'HashValue' does not name a type

when compiling the following code:

Expand|Select|Wrap|Line Numbers
  1. #include<iostream>
  2. using namespace std;
  3. #include <typeinfo>
  4.  
  5. class Object
  6. {
  7. protected:
  8.     virtual int CompareTo (Object const&) const = 0;
  9. public:
  10.     virtual ~Object ();
  11.     virtual bool IsNull () const;
  12.     virtual int Compare (Object const&) const;
  13.     virtual HashValue Hash () const = 0;
  14.     virtual void Put (ostream&) const = 0;
  15. };
  16. inline bool operator == (Object const& left, Object const& right)
  17.     { return left.Compare (right) == 0; }
  18.  
  19. inline bool operator != (Object const& left, Object const& right)
  20.     { return left.Compare (right) != 0; }
  21.  
  22. inline bool operator <= (Object const& left, Object const& right)
  23.     { return left.Compare (right) <= 0; }
  24.  
  25. inline bool operator <  (Object const& left, Object const& right)
  26.     { return left.Compare (right) <  0; }
  27.  
  28. inline bool operator >= (Object const& left, Object const& right)
  29.     { return left.Compare (right) >= 0; }
  30.  
  31. inline bool operator >  (Object const& left, Object const& right)
  32.     { return left.Compare (right) >  0; }
  33.  
  34. inline ostream& operator << (ostream& s, Object const& object)
  35.     { object.Put (s); return s; }
  36.  
  37.  
  38. Object::~Object ()
  39.     {}
  40.  
  41. bool Object::IsNull () const
  42.     { return false; }
  43.  
  44. int Object::Compare (Object const& object) const
  45. {
  46.     if (typeid (*this) == typeid (object))
  47.         return CompareTo (object);
  48.     else if (typeid (*this).before (typeid (object)))
  49.         return -1;
  50.     else
  51.         return 1;
  52. }
  53.  
section from the book i'm trying to implement:
Objects in Bruno Preiss's book

Also, not that it matters but this isn't for any class.
Nov 12 '07 #3
RedSon
5,000 Recognized Expert Expert
thanks for the response. i'll just be more specific.

error: 'HashValue' does not name a type

section from the book i'm trying to implement:
Objects in Bruno Preiss's book

Also, not that it matters but this isn't for any class.
Well its from a text book so it must be for some sort of class. In the code you provided HashValue is a data type. More specifically it is a user defined data type. So that means that in order for you to use HashValue as a data type you must first define HashValue. Or you can find a library that implements HashValue but that implementation may not be exactly what you want in a hash value.
Nov 13 '07 #4
entellus
6 New Member
Well its from a text book so it must be for some sort of class. In the code you provided HashValue is a data type. More specifically it is a user defined data type.
Apologies for not doing enough research up front. Turns out that the HashValue is defined as an unsigned int.
Thanks once again for the help.
Nov 13 '07 #5

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

Similar topics

1
3114
by: yan | last post by:
Hi, everybody. I'm new to this great forum, so hello! I start with a problem of my project. I have an Abstract Base Class used as base class for differentes Derived classes. The derived classes...
4
3093
by: Gopal-M | last post by:
I have the problem with sizeof operator I also want to implement a function that can return size of an object. My problem is as follows.. I have a Base class, say Base and there are many class...
1
1828
by: Matthias Kaeppler | last post by:
Sorry if this has been discussed before (I'm almost certain it has), but I didn't know what to google for. My problem is, I have a class, a gtkmm widget, and I want it to serve as a base class...
15
12764
by: jon | last post by:
How can I call a base interface method? class ThirdPartyClass :IDisposable { //I can not modify this class void IDisposable.Dispose() { Console.WriteLine( "ThirdPartyClass Dispose" ); } } ...
5
3140
by: Andy | last post by:
Hi all, I have a site with the following architecture: Common.Web.dll - Contains a CommonPageBase class which inherits System.Web.UI.Page myadd.dll - Contains PageBase which inherits...
9
5178
by: Sean Kirkpatrick | last post by:
To my eye, there doesn't seem to be a whole lot of difference between the two of them from a functional point of view. Can someone give me a good explanation of why one vs the other? Sean
9
5951
by: sloan | last post by:
I'm not the sharpest knife in the drawer, but not a dummy either. I'm looking for a good book which goes over Generics in great detail. and to have as a reference book on my shelf. Personal...
6
1822
by: MattWilson.6185 | last post by:
Hi, I'm trying to find out if something is possible, I have a few diffrent lists that I add objects to and I would like to be able to have a wrapper class that won't affect the internal object, for...
15
3503
by: Juha Nieminen | last post by:
I'm sure this is not a new idea, but I have never heard about it before. I'm wondering if this could work: Assume that you have a common base class and a bunch of classes derived from it, and...
0
7231
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
7336
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
7401
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...
1
7063
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
4720
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...
0
3211
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...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
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...

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.