From uhcosc1320-return-5-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul  8 00:55:48 2003
Return-Path: <uhcosc1320-return-5-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h685tmW11153467
	for <cosc155g@bayou.uh.edu>; Tue, 8 Jul 2003 00:55:48 -0500 (CDT)
Received: (qmail 26647 invoked by uid 108); 8 Jul 2003 05:58:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26394 invoked from network); 8 Jul 2003 05:57:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307080555.h685t54M1321063@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 8 Jul 2003 00:55:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] about the text book for cosc 1320 (fwd)
Status: O
X-IMAPbase: 1167487774 0000000712 $NotJunk
X-UID: 1
Content-Length: 668
X-Keywords: $NotJunk                                                                           

>I was looking for a textbook for the class and found
>many different editions with the same title.
>Which one should I buy?
>
>Is the following book right for the class?
>C++ How to Program (4th Edition)
>by Harvey M. Deitel, Paul J. Deitel

That should be fine. Please note that I will not be following any 
specific book page to page (or chapter by chapter). The above
books is only a recommended text, not a required one. Any decent book
that covers the topics mentioned in the syllabus is fine.

Regards,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-6-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul  8 22:06:15 2003
Return-Path: <uhcosc1320-return-6-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6936FW11237979
	for <cosc155g@bayou.uh.edu>; Tue, 8 Jul 2003 22:06:15 -0500 (CDT)
Received: (qmail 6240 invoked by uid 108); 9 Jul 2003 03:09:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3747 invoked from network); 9 Jul 2003 03:06:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307090302.h6932wJ11421216@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 8 Jul 2003 22:02:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Programming Forums (fwd)
Status: O
X-UID: 2
Content-Length: 400
X-Keywords: $NotJunk                                                                                           

This is a message from a fellow student in the class.

>    I setup a new set of forums for anyone in these programming classes so
>we could bounce ideas off one another for homework/assignments, study help,
>general questions, etc. The forums are located at
>http://forums.jasonshipman.com. Registration is free, but users registering
>cannot use an email account from AOL, Netscape.com, or CS.com.

From uhcosc1320-return-8-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul  9 04:57:59 2003
Return-Path: <uhcosc1320-return-8-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h699vxW11116036
	for <cosc155g@bayou.uh.edu>; Wed, 9 Jul 2003 04:57:59 -0500 (CDT)
Received: (qmail 15538 invoked by uid 108); 9 Jul 2003 10:00:46 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15321 invoked from network); 9 Jul 2003 10:00:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307090957.h699vMQl1319658@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 9 Jul 2003 04:57:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Examples written in class
Status: O
X-UID: 3
Content-Length: 314
X-Keywords: $NotJunk                                                                                           

The examples written in class will be posted right after the class 
at the following location:

http://www.cs.uh.edu/~svenkat/summer2003/ExamplesFromClass/

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-9-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:02:12 2003
Return-Path: <uhcosc1320-return-9-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A82C5Z1077909
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:02:12 -0500 (CDT)
Received: (qmail 10422 invoked by uid 108); 10 Jul 2003 08:05:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5716 invoked from network); 10 Jul 2003 07:57:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100753.h6A7rvwu1077549@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 02:53:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Namespaces (fwd)
Status: O
X-UID: 4
Content-Length: 1670
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>What is the purpose of using namespaces in C++
>programs?  Why do we use it?  What will happen if we
>don't use it?
>
>Thank you 

Hi

Let's say we are developing C++ code for a large project. We decide to
purchase two libraries that provide some functionalities that we need.
What happens if both the libraries, accidentally (or incidentally) have
classes with the same name, but mean two different things. For example,
both the libraries have a class named Transaction. In library 1, it has
to do with say database access. In library 2, it has to do with some
accounting transaction. In our code, if we write 

#include <library1header.h>
#include <library2header.h>

SomeClassFromLib1 obj1;
SomeClassFromLib2 obj2;
Transaction obj3;
...

The compiler will have trouble knowing which Transaction we are refering to.
Are we creating an object of Library 1's Transaction or Library 2's Transaction?

The purpose of namespace is to eliminate the name collision.

So, if the classes provided by Library 1 are part of a namespace say
Lib1 and those provided by Library 2 are part of Lib2, then we could write

#include <library1header.h>
#include <library2header.h>
using namespace Lib1;
using namespace Lib2;

SomeClassFromLib1 obj1;
SomeClassFromLib2 obj2;
Lib1::Transaction obj3;
...

Note how we explicitly mentioned that we are using Library 1's Transaction.
We did not have to resolve SomeClassFromLib1 and SomeClassFromLib2 since
they are not colliding in name, however. 

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-10-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:07:05 2003
Return-Path: <uhcosc1320-return-10-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A8755Z1078214
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:07:05 -0500 (CDT)
Received: (qmail 13398 invoked by uid 108); 10 Jul 2003 08:10:02 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11786 invoked from network); 10 Jul 2003 08:07:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100804.h6A841fX1078034@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 03:04:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Solutions for past assignment (fwd)
Status: O
X-UID: 5
Content-Length: 631
X-Keywords: $NotJunk                                                                                           

>Dr. Subramanium,

Hi,

Please feel free to address as Venkat.

>Do you post solutions for the assignments that you have given in the past as a reference, so that if people who are attempting to do those have something to refer if they are stuck with something???

No, I do not generally post solutions. Occasionally, however, I do post
solutions to select assignments if students requested for those in those
semesters and you may find them on the web site, if available.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-11-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:11:53 2003
Return-Path: <uhcosc1320-return-11-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A8Br5Z1078448
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:11:53 -0500 (CDT)
Received: (qmail 16199 invoked by uid 108); 10 Jul 2003 08:14:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15981 invoked from network); 10 Jul 2003 08:14:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100811.h6A8BLNj1078404@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 03:11:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] using the VS.NET ... (fwd)
Status: O
X-UID: 6
Content-Length: 877
X-Keywords: $NotJunk                                                                                           

>What do you mean by unmanaged project?
>Thanks.

In C++, as we discussed yesterday in class, it is your responsibility to
delete stuff from the heap at an appropriate time. In other words,
the so called Garbage Collection is for you to take care of.
In .NET platform, the garbage collection is automatic. They take care of
deallocating the objects from the heap. In addition, the platform runtime
provides various other services that typically you will have to code in
C++. Since these services are provided by the runtime/environment, these
code are called "managed" code. In contrast to that, code not executing 
within the .NET framework is called "unmanaged" code.

This course does not deal with .NET in any way.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-12-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:14:45 2003
Return-Path: <uhcosc1320-return-12-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A8Ei5Z1078583
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:14:45 -0500 (CDT)
Received: (qmail 17986 invoked by uid 108); 10 Jul 2003 08:17:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12675 invoked from network); 10 Jul 2003 08:08:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100805.h6A85axK1078108@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 03:05:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Please go over the Private part amd constructor (fwd)
Status: O
X-UID: 7
Content-Length: 392
X-Keywords: $NotJunk                                                                                           

>Venkat,
>Would you please go over Private and Constructor again
>Thanks

We will be discussing Constructors in class (we have not really
addressed this fully yet). We will also talk about access levels
of instance members in class. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-13-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:20:09 2003
Return-Path: <uhcosc1320-return-13-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A8K95Z1078890
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:20:09 -0500 (CDT)
Received: (qmail 21084 invoked by uid 108); 10 Jul 2003 08:23:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18466 invoked from network); 10 Jul 2003 08:18:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100815.h6A8FLVw1078627@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 03:15:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] a really quick q? (fwd)
Status: O
X-UID: 8
Content-Length: 966
X-Keywords: $NotJunk                                                                                           

>Sorry to bother yet I have a question::

It is no trouble at all. Keep those questions comming.

>how do I get the notes you have saved during the class period?

You can get the slides by visiting 
http://www.cs.uh.edu/~svenkat/summer2003
and clicking on Slides.

You can get the examples by visiting
http://www.cs.uh.edu/~svenkat/summer2003/ExamplesFromClass

>oh and also can I use dev-c++ to do the assignments =20
>thanks

You can use any thing you like. However, please note, your code has
to compile and run correctly either on the compiler on bayou, or
using Microsoft Visual Studio 6.0 or Microsoft Visual Studio 7.0 (which
is VS.NET). These are the compiler I have access to and I will compile
and execute your code in one of these (you have a choice of specifying
which on of these I should use).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From troy.beacleay@qwest.com Wed Jul  9 21:27:52 2003
Return-Path: <troy.beacleay@qwest.com>
Received: from uswgne22.uswest.com (uswgne22.uswest.com [204.26.87.76])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h6A2Rp5Z1051829
	for <cosc155g@bayou.uh.edu>; Wed, 9 Jul 2003 21:27:52 -0500 (CDT)
Received: from egate-ne7.uswc.uswest.com (egate.uswc.uswest.com [151.117.69.18])
	by uswgne22.uswest.com (8.xx.x/8.xx.x) with ESMTP id h6A20JE6010709
	for <cosc155g@bayou.uh.edu>; Wed, 9 Jul 2003 21:00:21 -0500 (CDT)
Received: from denntex012.qwest.net (localhost [127.0.0.1])
	by egate-ne7.uswc.uswest.com (8.12.9/8.12.9) with ESMTP id h6A20ICG025800
	for <cosc155g@bayou.uh.edu>; Wed, 9 Jul 2003 21:00:19 -0500 (CDT)
Received: by DENNTEX012.qwest.net with Internet Mail Service (5.5.2656.59)
	id <NFJGZYT4>; Wed, 9 Jul 2003 20:00:18 -0600
Message-ID: <6962AEC6833DD51196DE00508B63C0CD0A125C92@DENNTEX004.qwest.net>
From: "Beacleay, Troy W" <troy.beacleay@qwest.com>
To: "'cosc155g@bayou.uh.edu'" <cosc155g@bayou.uh.edu>
Subject: Why C uses caller cleanup of stack 
Date: Wed, 9 Jul 2003 20:00:17 -0600 
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2656.59)
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C34687.0297CFFE"
Status: O
X-UID: 9
Content-Length: 11839
X-Keywords: $NotJunk                                                                                           

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C34687.0297CFFE
Content-Type: text/plain

C makes the caller clean the stack to support a variable parameter list.
There are two ways to "clean" the stack.  The called function can use the
assembly instruction RET x when returning execution to the calling routine
where x is the number of bytes to adjust the stack pointer so that that
space is reclaimed.  Conversely, the caller can do it after execution is
returned to it.  Unfortunately, the RET instruction only takes immediate
operands which means the compiler has to know at compile time the number of
bytes to compile in that location.  That means that the number of parameters
has to be fixed so that the number of bytes to "clean" with the RET
instruction can be known.  C supports a variable number of parameters, e.g.
the printf() function.  In order to do that, the caller PUSHes any number of
parameters that it wants to on the stack and also PUSHes the actual number
of parameters so that the called function can know how many to POP off and
use.  Since the caller knows how many it PUSHed, it can clean the stack
appropriately when control returns to it.
 
Troy Beacleay
Qwest Communications
Lead Software Development Engineer
===== Phone =====
Office:   303.785.8951
Cell:     281.450.3113
====== IM =======
MSN IM:   tbeacleay@hotmail.com
Yahoo IM: tbeacleay
AOL IM:   tbeacleay
ICQ:      41883494
 

------_=_NextPart_001_01C34687.0297CFFE
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 11">
<meta name=3DOriginator content=3D"Microsoft Word 11">
<link rel=3DFile-List href=3D"cid:filelist.xml@01C3465D.1856F240">
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:UseWord2002TableStyleRules/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState=3D"false" LatentStyleCount=3D"156">
 </w:LatentStyles>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:Courier;
	panose-1:2 7 4 9 2 2 5 2 4 4;
	mso-font-alt:"Courier New";
	mso-font-charset:0;
	mso-generic-font-family:modern;
	mso-font-format:other;
	mso-font-pitch:fixed;
	mso-font-signature:3 0 0 0 1 0;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:1627421319 -2147483648 8 0 66047 0;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:536871559 0 0 0 415 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0in;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:#AA00AA;
	text-decoration:underline;
	text-underline:single;}
span.EmailStyle18
	{mso-style-type:personal-compose;
	mso-style-noshow:yes;
	mso-ansi-font-size:10.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:Verdana;
	mso-ascii-font-family:Verdana;
	mso-hansi-font-family:Verdana;
	color:windowtext;
	font-weight:normal;
	font-style:normal;
	text-decoration:none;
	text-underline:none;
	text-decoration:none;
	text-line-through:none;}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */=20
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin:0in;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";
	mso-ansi-language:#0400;
	mso-fareast-language:#0400;
	mso-bidi-language:#0400;}
</style>
<![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3D"#AA00AA" =
style=3D'tab-interval:.5in'>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'>C makes the caller clean the stack to support a =
variable
parameter list.<span style=3D'mso-spacerun:yes'>&nbsp; </span>There are =
two ways
to "clean" the stack. <span style=3D'mso-spacerun:yes'>&nbsp;</span>The
called function can use the assembly instruction RET x when returning =
execution
to the calling routine where x is the number of bytes to adjust the =
stack
pointer so that that space is reclaimed.<span =
style=3D'mso-spacerun:yes'>&nbsp;
</span>Conversely, the caller can do it after execution is returned to =
it.<span
style=3D'mso-spacerun:yes'>&nbsp; </span>Unfortunately, the RET =
instruction only
takes immediate operands which means the compiler has to know at =
compile time the
number of bytes to compile in that location.<span
style=3D'mso-spacerun:yes'>&nbsp; </span>That means that the number of =
parameters
has to be fixed so that the number of bytes to "clean" with the RET
instruction can be known.<span style=3D'mso-spacerun:yes'>&nbsp; =
</span>C
supports a variable number of parameters, e.g. the <span =
class=3DGramE>printf(</span>)
function.<span style=3D'mso-spacerun:yes'>&nbsp; </span>In order to do =
that, the
caller <span class=3DSpellE>PUSHes</span> any number of parameters that =
it wants
to on the stack and also <span class=3DSpellE>PUSHes</span> the actual =
number of
parameters so that the called function can know how many to POP off and
use.<span style=3D'mso-spacerun:yes'>&nbsp; </span>Since the caller =
knows how
many it <span class=3DSpellE>PUSHed</span>, it can clean the stack =
appropriately
when control returns to it.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 face=3DVerdana><span =
style=3D'font-size:10.0pt;
font-family:Verdana'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><b><font size=3D2 color=3Dnavy face=3DTahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma;color:navy;font-weight:bold=
;
mso-no-proof:yes'>Troy Beacleay<br>
</span></font></b><b><font size=3D1 color=3D"#0080ff" =
face=3DTahoma><span
style=3D'font-size:7.5pt;font-family:Tahoma;color:#0080FF;font-weight:bo=
ld;
mso-no-proof:yes'>Qwest Communications<br>
</span></font></b><font size=3D1 color=3Dnavy face=3DTahoma><span =
style=3D'font-size:
7.5pt;font-family:Tahoma;color:navy;mso-no-proof:yes'>Lead Software =
Development
Engineer</span></font><span =
style=3D'mso-no-proof:yes'><o:p></o:p></span></p>

<p class=3DMsoNormal><font size=3D1 color=3Dnavy face=3DCourier><span =
style=3D'font-size:
7.5pt;font-family:Courier;mso-bidi-font-family:Tahoma;color:navy;mso-no-=
proof:
yes'>=3D=3D=3D=3D=3D <strong><b><font face=3DCourier><span =
style=3D'font-family:Courier;
mso-bidi-font-family:Tahoma'>Phone</span></font></b></strong> =
=3D=3D=3D=3D=3D</span></font><span
style=3D'mso-no-proof:yes'><o:p></o:p></span></p>

<p class=3DMsoNormal><font size=3D1 color=3Dnavy face=3DCourier><span =
style=3D'font-size:
7.5pt;font-family:Courier;mso-bidi-font-family:Tahoma;color:navy;mso-no-=
proof:
yes'>Office:&nbsp;&nbsp; </span></font><strong><b><font size=3D1 =
color=3Dblack
face=3DCourier><span =
style=3D'font-size:7.5pt;font-family:Courier;mso-bidi-font-family:
Tahoma;color:black;mso-no-proof:yes'>303.785.8951</span></font></b></str=
ong><span
style=3D'mso-no-proof:yes'><o:p></o:p></span></p>

<p class=3DMsoNormal><font size=3D1 color=3Dnavy face=3DCourier><span =
style=3D'font-size:
7.5pt;font-family:Courier;mso-bidi-font-family:Tahoma;color:navy;mso-no-=
proof:
yes'>Cell:&nbsp;&nbsp;&nbsp;&nbsp; </span></font><strong><b><font =
size=3D1
color=3Dblack face=3DCourier><span =
style=3D'font-size:7.5pt;font-family:Courier;
mso-bidi-font-family:Tahoma;color:black;mso-no-proof:yes'>281.450.3113</=
span></font></b></strong><span
style=3D'mso-no-proof:yes'><o:p></o:p></span></p>

<p class=3DMsoNormal><font size=3D1 color=3Dnavy face=3DCourier><span =
style=3D'font-size:
7.5pt;font-family:Courier;mso-bidi-font-family:Tahoma;color:navy;mso-no-=
proof:
yes'>=3D=3D=3D=3D=3D=3D <strong><b><font face=3DCourier><span =
style=3D'font-family:Courier;
mso-bidi-font-family:Tahoma'>IM</span></font></b></strong> =
=3D=3D=3D=3D=3D=3D=3D</span></font><font
color=3Dnavy><span =
style=3D'color:navy;mso-no-proof:yes'><o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D1 color=3Dnavy face=3DCourier><span =
style=3D'font-size:
7.5pt;font-family:Courier;mso-bidi-font-family:Tahoma;color:navy;mso-no-=
proof:
yes'>MSN IM:&nbsp;<span style=3D'mso-spacerun:yes'>&nbsp; =
</span></span></font><strong><b><font
size=3D1 color=3Dblack face=3DCourier><span =
style=3D'font-size:7.5pt;font-family:Courier;
mso-bidi-font-family:Tahoma;color:black;mso-no-proof:yes'>tbeacleay@hotm=
ail.com</span></font></b></strong><font
color=3Dnavy><span =
style=3D'color:navy;mso-no-proof:yes'><o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D1 color=3Dnavy face=3DCourier><span =
style=3D'font-size:
7.5pt;font-family:Courier;color:navy;mso-no-proof:yes'>Yahoo IM: =
</span></font><strong><b><font
size=3D1 color=3Dblack face=3DCourier><span =
style=3D'font-size:7.5pt;font-family:Courier;
color:black;mso-no-proof:yes'>tbeacleay<o:p></o:p></span></font></b></st=
rong></p>

<p class=3DMsoNormal><font size=3D1 color=3Dnavy face=3DCourier><span =
style=3D'font-size:
7.5pt;font-family:Courier;color:navy;mso-no-proof:yes'>AOL IM:<span
style=3D'mso-spacerun:yes'>&nbsp;&nbsp; =
</span></span></font><strong><b><font
size=3D1 color=3Dblack face=3DCourier><span =
style=3D'font-size:7.5pt;font-family:Courier;
color:black;mso-no-proof:yes'>tbeacleay</span></font></b></strong><font
color=3Dnavy><span =
style=3D'color:navy;mso-no-proof:yes'><o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D1 color=3Dnavy face=3DCourier><span =
style=3D'font-size:
7.5pt;font-family:Courier;color:navy;mso-no-proof:yes'>ICQ:&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;
</span></font><strong><b><font size=3D1 color=3Dblack =
face=3DCourier><span
style=3D'font-size:7.5pt;font-family:Courier;color:black;mso-no-proof:ye=
s'>41883494</span></font></b></strong><font
color=3Dnavy><span =
style=3D'color:navy;mso-no-proof:yes'><o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>

------_=_NextPart_001_01C34687.0297CFFE--

From uhcosc1320-return-14-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:23:01 2003
Return-Path: <uhcosc1320-return-14-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A8N15Z1079042
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:23:01 -0500 (CDT)
Received: (qmail 22684 invoked by uid 108); 10 Jul 2003 08:25:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20651 invoked from network); 10 Jul 2003 08:22:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100819.h6A8JBR81078815@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 03:19:11 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Questions (fwd)
Status: O
X-UID: 10
Content-Length: 1128
X-Keywords: $NotJunk                                                                                           

>Dr. Subramaniam,
>
>I am a full time ****** University Engineering student.  I am taking your class this summer to get ahead.  I was wondering when you were going to assign the first assignment and when it will be due.  
>

I will send out an annoucement about this tomorrow.

>I live an hour and a half away and have trouble comuting to UH on the weekends and was wondering what I need to do in order to get the program needed to complete the assignments home so I do not have to drive to UH to work on the assignment.
>
>Thank You,

You have a couple of options. You may logon to bayou remotely and 
compile your code on that machine. In this case, you do not need any
compilers on your home computer (except ability to connect to bayou).
Alternately, you may use Visual Studio 6.0 (or equivalent). Please
read my response to the previous email to the mailing list about this.

I am in the process of contacting the IT dept. to get an account on bayou
for every one.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-15-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:26:18 2003
Return-Path: <uhcosc1320-return-15-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A8QI5Z1079190
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:26:18 -0500 (CDT)
Received: (qmail 24560 invoked by uid 108); 10 Jul 2003 08:29:09 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22138 invoked from network); 10 Jul 2003 08:25:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100822.h6A8M1kE1078988@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 03:22:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] unwinding stack (fwd)
Status: O
X-UID: 11
Content-Length: 1524
X-Keywords: $NotJunk                                                                                           

>Question:
>Why is it that the unwinding of stack is done by caller in C and C++ but by callee in Pascal??
> 
>Ans: When we are filling a stack we are consumming memory thereby decrementing stack pointer(SP).
>Memory is filled from higher memory value to lower memory point in a stack segment.
> 
>When we need to unwind a stack we actually need to increment SP.In pascal this 
>incrementation is done within the called procedure(callee) by adding the number of used 
>up bytes(the space the arguments took) in return statement.
>But in C & C++ the caller function adjusts the stack ptr by adding used up bytes to it
>after we have returned back to caller.
>  
>Say we want to add 'a' and 'b' using method addNum.In pascal the assembly code will go like:
> 
>push a
>push b
>call addNum
> 
>and within addNum the last two statements will be
>pop bp
>ret 8  ;if we assume a & b are 4 bytes each 
> 
>this 'ret 8' adds 8 to SP.
> 
>In C & C++,it will go like
>push a
>push b
>call addNum
>add sp,8
>Hence addition to SP is done after coming out of callee.
> 
>In brief  incrementation of SP is what that unwinds the stack,which is done in 'callee' in Pascal but in caller in C,C++.
> 

I got a number of responses. Only one of them matches the correct answer.
This one does not. It explains how and not why? However, I am
forwarding it since it may be useful to read.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-16-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:29:53 2003
Return-Path: <uhcosc1320-return-16-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A8Tq5Z1079375
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:29:53 -0500 (CDT)
Received: (qmail 26758 invoked by uid 108); 10 Jul 2003 08:32:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25510 invoked from network); 10 Jul 2003 08:30:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100827.h6A8RUbl1079256@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 03:27:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] OOP (fwd)
Status: O
X-UID: 12
Content-Length: 546
X-Keywords: $NotJunk                                                                                           

>Dear Dr. Subramaniam:  
>
>Please send me the information so I can print out the examples that you 
>did in class.  I only subscribe to the e-mail list late this morning.
>
>Sincerely,

Hi

You can get the slides by visiting
http://www.cs.uh.edu/~svenkat/summer2003
and clicking on Slides.

You can get the examples by visiting
http://www.cs.uh.edu/~svenkat/summer2003/ExamplesFromClass

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-17-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:31:33 2003
Return-Path: <uhcosc1320-return-17-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A8VW5Z1079491
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:31:32 -0500 (CDT)
Received: (qmail 27761 invoked by uid 108); 10 Jul 2003 08:34:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24236 invoked from network); 10 Jul 2003 08:28:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100825.h6A8PSL61079145@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 03:25:28 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Why C uses caller cleanup of stack (fwd)
Status: O
X-UID: 13
Content-Length: 1388
X-Keywords: $NotJunk                                                                                           

>C makes the caller clean the stack to support a variable parameter list.

Congratulations. That's the reason! You are the winner of the bonus point.
Read on if you want to know more about this. 

>There are two ways to "clean" the stack.  The called function can use the
>assembly instruction RET x when returning execution to the calling routine
>where x is the number of bytes to adjust the stack pointer so that that
>space is reclaimed.  Conversely, the caller can do it after execution is
>returned to it.  Unfortunately, the RET instruction only takes immediate
>operands which means the compiler has to know at compile time the number of
>bytes to compile in that location.  That means that the number of parameters
>has to be fixed so that the number of bytes to "clean" with the RET
>instruction can be known.  C supports a variable number of parameters, e.g.
>the printf() function.  In order to do that, the caller PUSHes any number of
>parameters that it wants to on the stack and also PUSHes the actual number
>of parameters so that the called function can know how many to POP off and
>use.  Since the caller knows how many it PUSHed, it can clean the stack
>appropriately when control returns to it.

Good job :).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-18-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 10 03:34:52 2003
Return-Path: <uhcosc1320-return-18-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6A8Yq5Z1079690
	for <cosc155g@bayou.uh.edu>; Thu, 10 Jul 2003 03:34:52 -0500 (CDT)
Received: (qmail 29713 invoked by uid 108); 10 Jul 2003 08:37:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27255 invoked from network); 10 Jul 2003 08:33:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307100830.h6A8US5A1079427@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 10 Jul 2003 03:30:28 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Permission to access 07092003.zip (fwd)
Status: O
X-UID: 14
Content-Length: 683
X-Keywords: $NotJunk                                                                                           

>Venkat,
>I'm unable to access the ZIP file of examples from July 9th.  I get a
>message like this:
>Forbidden
>You don't have permission to access
>/~svenkat/summer2003/ExamplesFromClass/07092003.zip on this server.
>
>I can download the ZIP file from the day before, but not this one.  Can you
>make this available to everyone?
>Thanks,

Strange. I have no idea why this happended since I uploaded the two
just about the same way. Sorry about that and thanks for bringing this
to my attention. It should be accessible now.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-19-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 05:07:12 2003
Return-Path: <uhcosc1320-return-19-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BA7B5Z1176732
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 05:07:11 -0500 (CDT)
Received: (qmail 25345 invoked by uid 108); 11 Jul 2003 10:10:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21677 invoked from network); 11 Jul 2003 10:04:40 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111001.h6BA1UtZ1176558@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 05:01:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] a really quick q? (fwd)
Status: O
X-UID: 15
Content-Length: 530
X-Keywords: $NotJunk                                                                                           

>Can you please explain about the complier on bayou?  I don't really have a descent understanding of it?  Thanks.

The compiler on the UNIX machine bayou is a GNU compiler. 
You can access it by typing cxx.

For example, to compile a C++ source file, you may type

cxx -o programName sourcefile.cpp sourcefile2.cpp

I will be glad to provide more information if you need.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-20-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 05:11:25 2003
Return-Path: <uhcosc1320-return-20-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BABP5Z1176924
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 05:11:25 -0500 (CDT)
Received: (qmail 28230 invoked by uid 108); 11 Jul 2003 10:14:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24966 invoked from network); 11 Jul 2003 10:09:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111006.h6BA6RqY1176782@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 05:06:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Symbol table, Stack overflow and Visual Studio keyboard short cut keys (fwd)
Status: O
X-UID: 16
Content-Length: 1741
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>When you were talking  about referencing (aliasing),
>you mentioned some thing about symbol table.  Can you
>please give us more information on what a symbol table
>is? how it looks like?  how can we look at it in
>Visual Studio?

When a compiler is in the process of parsing and analyzing your code,
it maps variable names to relative memory addresses for those 
variables. This is the symbol table. When you access a variable,
in the compile code, it actually specifies the relative address to
access the data from. You will learn more about these in a course
on Assembly programming or Compiler. I don't think the symbol table
is as such explosed for you to see. 

>As you mentioned in class, the compiler will never
>tell you that there is a memory leak in the C++ code. 
>Will the compiler give any indication that the code is
>overflowing the stack?

No, compiler will not help you with either of these. 
For memory leak, you may use products like BoundsChecker or
Purify. I am not aware of any thing that will alert you about
stack overflow at compile time.

>After you write an interface and work on the
>implementation part,
>I noticed several times that you press some keyboard
>short cut keys combination to pop up a window that
>gives you all the methods and variables you can select
>to avoid typo .  Can you please tell us what these
>short keys are?
>
>Thank you

This feature is called intellisense. When you hit the . after an object
as in "obj.," the intellisense menu pops up. You may also hold the
control key down and hit space to bring it up.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-21-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 05:19:33 2003
Return-Path: <uhcosc1320-return-21-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BAJX5Z1177445
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 05:19:33 -0500 (CDT)
Received: (qmail 1044 invoked by uid 108); 11 Jul 2003 10:22:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 732 invoked from network); 11 Jul 2003 10:21:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111018.h6BAIhus1177399@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 05:18:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] [please disregard my earlier mail]Doubt regarding the references program (fwd)
Status: O
X-UID: 17
Content-Length: 2899
X-Keywords: $NotJunk                                                                                           

>Hello Dr.Venkat,
>    In my earlier mail,which i sent you regarding the references program,i think i missed out on something. I am really sorry for that.
>     I have a doubt regarding the references program.
> 
>Your code: Sample.h
> 
>class Sample
>{
>public :
> Sample() { val = 2; }
> const int* getVal() const
> {
>  return &val;
> }
>private:
> int val;
>};
> 
>The change i made:
> 
>int* getVal() const
>
>Your Code: main.cpp
> 
>#include "Sample.h"
>#include <iostream>
>using namespace std;
>void main()
>{
> int a = 4;
> int b = 5;
> int& r = a;
> cout << a << " " << r << " " << b << endl;
> r = b;
> cout << a << " " << r << " " << b << endl;
> Sample obj;
> const int* p = obj.getVal();
> cout << *p << endl;
> //*p = 7;  //This will not compile.
> cout << *(obj.getVal()) << endl;
>}
> 
>The change i made:
> 
>int* p = obj.getVal();
> 
>i removed --------const to the left ---------- in both programs.If i try to compile i get an error
> 
>Error: Cannot convert from const int * to int *.
> 
>I did not understand why i got an error when i was not trying to modify the object.
> 
>Sorry if i missed something very silly.
> 
>Thanks and Regards.

Let's take this in two steps.

Within the class, if we have

int* getVal() const
{
	return &val;
}

The const says that the method getVal will not modify in any way the
contents of the object on which it is called. However, this metho is
returning a pointer to a member of the object. Using this pointer, someone
who is calling getVal can then modify the content of the object.

Now, let us say we have a const object on hand.

const Sample aConstObj;

I may write some thing like

int* p = aConstObj.getVal();
*p = 22;

See how I took a const object and called a const method on it, but
gained access to its member through which I can modify the object.
This breaks the constness of the object that I am using. 

The C++ compiler wants to eliminate the possibilities like this.

That is why it insist that you write

const int* getVal() const.

This says that getVal will not modify the object, and it will also 
return to the caller only a read-only pointer to its member.

Now let us consider this getVal which has const both on far right and
far left.

If I write

Sample anObject;
int* p = anObject.getVal();

Since getVal is returning a read-only pointer, if you are allowed to
assign it to a read-write pointer, then using the read-write pointer,
you may modify the content. This is again in violation of constness.
If some one gives you a read-only pointer, you should not use it to
modify the contents of the data. So, a read-only pointer may be copied into
only a read-only pointer (const int*) and not a read-write pointer (int*).

Hope this addresses your question.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-22-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 05:31:35 2003
Return-Path: <uhcosc1320-return-22-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BAVZ5Z1177974
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 05:31:35 -0500 (CDT)
Received: (qmail 8888 invoked by uid 108); 11 Jul 2003 10:34:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5823 invoked from network); 11 Jul 2003 10:29:45 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111026.h6BAQbgJ1177711@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 05:26:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] C vs. Fortran function calls (fwd)
Status: O
X-UID: 18
Content-Length: 1047
X-Keywords: $NotJunk                                                                                           

>Dr. Subramaniam,
>
>My name is ******, and I am in your COSC 1320 class.  In =
>Wednesday night's class, you presented the question of why C++ requires =
>the calling function to unroll the stack, while in Fortran the called =
>function unrolls the stack.  I believe I have found the answer:
>
>In C, functions have the capability of calling a function with a varying =
>number of arguments. ... rest of the mail deleted....

Actually it was with reference to Pascal, but Fortran is fine as well.

I received some 12 email responses to this question. I posted two
of them yesterday. The others I am not posting. If I ask such bonus
questions, I will generally post the correct response or those that
are interesting to share.

Please note that I had said the first person to respond with a correct
answer gets the bonus point and that was given away in the mail sent yesterday.

Regards,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-23-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 05:34:39 2003
Return-Path: <uhcosc1320-return-23-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BAYd5Z1178182
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 05:34:39 -0500 (CDT)
Received: (qmail 10748 invoked by uid 108); 11 Jul 2003 10:37:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9978 invoked from network); 11 Jul 2003 10:36:17 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111033.h6BAX95N1178093@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 05:33:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] a question about "delete" (fwd)
Status: O
X-UID: 19
Content-Length: 1602
X-Keywords: $NotJunk                                                                                           

><html><div style='background-color:'><DIV></DIV>
><DIV>To Dr. Subramaniam,</DIV>
><DIV>This is in reference to COSC 1320.&nbsp; I probably should have asked you after class, but I had to leave quite quickly.&nbsp; You were saying that the operation "delete" frees the memory from a heap and not a stack.&nbsp; Later you said that a "null" can be deleted.&nbsp; My question is:&nbsp; What is the status of a null and where does it go, in the stack or the heap?&nbsp; </DIV>
><DIV>Also, I'm not sure how Pascal works, but in C, wouldn't the "caller" and not the "callee", have to free up the stack&nbsp;memory, due to the "return" function?</DIV>
><DIV>Thank you for your time</DIV>

Generally, when you use pointers, how do you know if a pointer is
pointing at some thing or not. As a convention, 0 is used to indicate this.

If the value of a pointer (that is the address that the pointer points to)
is 0, then it is considered to be pointing at nothing.

int* p = new int;
// p will be a non-zero value which is the address of the int created on the
// heap.

delete p;
// We just released the memory that was allocated on the heap.

p = 0;
// p is not pointing at any thing right now.

delete p;
// Since p is 0, this request to delete is simply ignored.

This is like saying, delete p is replace by

if (p != 0) delete p;

Hope this clarifies.

Other emails have discussed the calling convention and stack unwinding.
Please refer to those.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-24-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 05:37:06 2003
Return-Path: <uhcosc1320-return-24-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BAb55Z1178315
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 05:37:05 -0500 (CDT)
Received: (qmail 12504 invoked by uid 108); 11 Jul 2003 10:40:02 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7080 invoked from network); 11 Jul 2003 10:31:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111028.h6BASlcO1177820@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 05:28:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Namespaces (fwd)
Status: O
X-UID: 20
Content-Length: 2671
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>Thank you for the detailed explanation.  However, I
>still have one more question regarding namespaces. 
>Several times I 've noticed in class examples that you
>type "using namespaces std;".
>What's the purpose of that?  if we don't write it the
>code still compiles and runs fine.  
>
>Thank you

If I use #include <iostream> (without the .h), the IO classes and 
objects like cout, cin, etc. belong to the std namespace. 
using namespace std says that I am using the classes and objects
from that namespace in the code.

If you write #include <iostream.h> (with the .h), then you are 
using the old IO library in which no namespaces were used and
you do not need any using namespace std; statement.

Venkat

>--- "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>wrote:
>> >Hello Venkat,
>> >
>> >What is the purpose of using namespaces in C++
>> >programs?  Why do we use it?  What will happen if
>> we
>> >don't use it?
>> >
>> >Thank you 
>> 
>> Hi
>> 
>> Let's say we are developing C++ code for a large
>> project. We decide to
>> purchase two libraries that provide some
>> functionalities that we need.
>> What happens if both the libraries, accidentally (or
>> incidentally) have
>> classes with the same name, but mean two different
>> things. For example,
>> both the libraries have a class named Transaction.
>> In library 1, it has
>> to do with say database access. In library 2, it has
>> to do with some
>> accounting transaction. In our code, if we write 
>> 
>> #include <library1header.h>
>> #include <library2header.h>
>> 
>> SomeClassFromLib1 obj1;
>> SomeClassFromLib2 obj2;
>> Transaction obj3;
>> ...
>> 
>> The compiler will have trouble knowing which
>> Transaction we are refering to.
>> Are we creating an object of Library 1's Transaction
>> or Library 2's Transaction?
>> 
>> The purpose of namespace is to eliminate the name
>> collision.
>> 
>> So, if the classes provided by Library 1 are part of
>> a namespace say
>> Lib1 and those provided by Library 2 are part of
>> Lib2, then we could write
>> 
>> #include <library1header.h>
>> #include <library2header.h>
>> using namespace Lib1;
>> using namespace Lib2;
>> 
>> SomeClassFromLib1 obj1;
>> SomeClassFromLib2 obj2;
>> Lib1::Transaction obj3;
>> ...
>> 
>> Note how we explicitly mentioned that we are using
>> Library 1's Transaction.
>> We did not have to resolve SomeClassFromLib1 and
>> SomeClassFromLib2 since
>> they are not colliding in name, however. 
>> 
>> Hope this helps.
>> 
>> Venkat Subramaniam
>> --				
>> cosc155g@bayou.uh.edu		Department of Computer
>> Science
>> http://www.cs.uh.edu/~svenkat 	University of
>> Houston, Houston, Tx 77204-3475

From uhcosc1320-return-25-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 05:48:25 2003
Return-Path: <uhcosc1320-return-25-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BAmP5Z1178839
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 05:48:25 -0500 (CDT)
Received: (qmail 19778 invoked by uid 108); 11 Jul 2003 10:51:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15704 invoked from network); 11 Jul 2003 10:44:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111041.h6BAfkCw1178537@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 05:41:46 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] a question (fwd)
Status: O
X-UID: 21
Content-Length: 1589
X-Keywords: $NotJunk                                                                                           

>could you tell me the difference between & and *?
>How could I get an idea of how they work?

& and * are used in a couple of different ways and that is 
confusing at times. First, & is used as AND operation and
* for multiplication. In this discussion, we will not even
consider that. We are more interested in the memory related 
operations.

int* p; // We just defined a pointer. How to know that? Note that
they type (in this case int) precedes the *. This is true even if you
write int *p;

Now, consider *p. We have dereferenced the pointer.

This gets the value of the interger variable that is at the address
pointed by this pointer p. If value of p was 120888, then the value
at that address is what we are talking about here.

Let's talk about & now.

int a = 5;
p = &a; // We have taken the address of a. How to know this? Note that
there is no type before &. 

In this case, p now holds the address of (and hence points to) a.

However, 

int& b = a; // We define a reference named "b" to the variable "a." How to
know this? note the type (in this case int) is in front of &. This is true
even if you write int &b = a;

Based on the context of declaration versus usage, you need to understand
if * is used to define a pointer or to dereference one. Similarly,
if & is used to get the address or to create a reference.

Hope this helps. Feel free to expand on this and ask further questions
if some thing is not clear.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-26-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 05:53:56 2003
Return-Path: <uhcosc1320-return-26-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BArt5Z1179090
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 05:53:56 -0500 (CDT)
Received: (qmail 23626 invoked by uid 108); 11 Jul 2003 10:56:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21820 invoked from network); 11 Jul 2003 10:54:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111051.h6BApC3r1178985@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 05:51:12 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Following the Book (fwd)
Status: O
X-UID: 22
Content-Length: 492
X-Keywords: $NotJunk                                                                                           

><P>Venkat,</P>
><P>Can you suggest page numbers from the text to follow the lectures?</P>
><P>Thanks<BR><BR>

Please note that I do not follow the book page to page or chapter to 
chapter.

In the 4th edition of Deital and Deital, here are things that
cover what we have seen so far:

Parts of chapter 5
Chapter 6
Parts of chapter 7

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-27-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 05:58:47 2003
Return-Path: <uhcosc1320-return-27-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BAwl5Z1179340
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 05:58:47 -0500 (CDT)
Received: (qmail 26912 invoked by uid 108); 11 Jul 2003 11:01:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19496 invoked from network); 11 Jul 2003 10:51:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111047.h6BAlrEx1178785@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 05:47:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubt regarding String Example program (fwd)
Status: O
X-UID: 23
Content-Length: 2032
X-Keywords: $NotJunk                                                                                           

>Hello Dr.Venkat,
> 
>I have a doubt in String Example program discussed in wednesday's class.
> 
>Your code: String.h
> 
>class String
>{
>public:
> String() { pRealStr = 0; }
> void set(const char* pVal)
> {
>  if (pVal != 0)
>  {
>   
>   delete[] pRealStr;
>   pRealStr = new char[strlen(pVal) + 1];
>   strcpy(pRealStr, pVal);
>  }
> }
> const char* get() const
> {
>  return pRealStr;
> }
>private:
> char* pRealStr;
>};
> 
>In the above code, 
>1.why do we need to to delete pRealStr explicitly when pRealStr is allocated on stack.

You never delete any thing from the stack. 

int* p = new int;

p is on the stack, the int is created on the heap.

delete p; // This says take the pointer's value, and go to that address which
//is on the heap and deallocate that memory on the heap.

When ever you say delete, you are deallocating the memory whose address is
help in the pointer that follows delete.

>2.Also when i commented out 
>          delete[] pRealStr;
>and compiled the code, i did not get any error.everything worked fine.

You see the word every thing worked fine is dangerous. 
It is like saying, I drove on a one way street in the wrong direction 
at 11PM and every thing was fine.

What you had was memory leak if you remove the delete[] pRealStr.

>and when i compile the code as it is without any changes,i get ouput as
>hello
>hi.
> 
>So, am little confused sir.
> 
>Thanks and Regards.

If you do not release the memory you use, you end up with memory leak.
This may not show up as a major concern in a small program. But in a
large program or one that runs for a long time, this will eventually be
a problem. For example, yesterday we say "Low on virtual memory" error
show up on my system when I kept creating on the heap with out deleting.

I will try to put together a simple program to illustrate this and
send it by email later this weekend.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-28-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 11 06:03:33 2003
Return-Path: <uhcosc1320-return-28-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6BB3X5Z1179573
	for <cosc155g@bayou.uh.edu>; Fri, 11 Jul 2003 06:03:33 -0500 (CDT)
Received: (qmail 30318 invoked by uid 108); 11 Jul 2003 11:06:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29817 invoked from network); 11 Jul 2003 11:05:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307111102.h6BB2Y6D1179526@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 11 Jul 2003 06:02:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 1 and HW 1 posted
Status: O
X-UID: 24
Content-Length: 400
X-Keywords: $NotJunk                                                                                           

Greetings,

Assignment 1 and Homework 1 have been posted. 

Please visit 
http://www.cs.uh.edu/~svenkat/summer2003/
and click on the link "HWs/Assigns."

I am open to any questions you may have. So, do not hesitate to ask 
questions.

Enjoy.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-29-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 09:20:36 2003
Return-Path: <uhcosc1320-return-29-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DEKa5Z1345110
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 09:20:36 -0500 (CDT)
Received: (qmail 3592 invoked by uid 108); 13 Jul 2003 14:23:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3317 invoked from network); 13 Jul 2003 14:23:06 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131419.h6DEJl1V1344964@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 09:19:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] nothing important.  just personal comments (fwd)
Status: O
X-UID: 25
Content-Length: 5015
X-Keywords: $NotJunk                                                                                           

>Venkat,
>          I was absolutely astounded today in class to learn that
>encapsulation was not preserved at the object level.  To me, that seems
>extremely bad.  It seems so bad that I would never use it.  I have been
>programming for years in OOP and pseudo OOP languages including VB6, Java,
>and C# and the concept is so alien to me that I didn't even know you could
>access private member variables between objects of the same type.  It seems
>inherently dangerous to me.  Let me explain my position by extending your
>own encapsulation analogy.  Let's say I'm a clerk at a register.  I don't
>want the customer to be able to reach into my drawer and pull money out, I
>want to do that for him so I can make sure everything is done properly, i.e.
>I want to make sure my register moves from one valid state to another.  By
>the same token, if you are also a clerk at a register next to me, I don't
>want you sticking your hands in my drawer either.  Even though you are
>Employee of the Month, I'm still responsible for my register so I should be
>the one handling its state.  You could still mess it up even though you're a
>clerk too.  

Hi

And if Dr. Jones needs a heart transplant, then the heart will be given to
Dr. Jones and we would request him to place it himself and we will not
have another Dr. do the transplantation either. ;)

>On a related note, if I have accessor methods for private member variables,
>I always use those accessors even within my class.  I never manipulate the
>private variables outside those accessors.   If you start messing around
>with the variables directly, all through your class, it's that much harder
>to make sure you keep your object in a valid state.  You don't want the
>business rules for that piece of data spread out through the class.  I like
>to concentrate them in one place...the accessors.  Obviously, the guys who
>design these languages like C++, Java, and C# are smarter than me and know
>way more about this stuff, so they may have valid reasons for allowing all
>these conditions, but until I reach that level of comprehension, I will
>consider my paradigm to be an OOP enhancement.  Can you agree with any of my
>points?

I would agree with most of what you are saying in the second paragraph
in principle, except for the word "always." You are assuming that
all the state information that needs to be maintained are available 
through public accessors. That is not the case all the time. 
There are some states that can't be modified or even accessed using a 
public accessor (or should not be). For example, let's say I have a Car 
class with year of make and miles (both of which are private) and 
a constructor that takes year of make as argument and it also sets 
miles to 0. It also has a drive method which will increase the miles 
value. There is no setMiles method (as you would imagine you do not want 
a user of the class to set the miles). Now, I want to make a copy of the 
Car (assume for whatever reason). Within the copy constructor of the Car, 
you can argue that I can call getYear and getMiles of the other car.
For example

Car(const Car& other)
{
	year = other.getYear();
	miles = other.getMiles();
}

Now, assume that the Car also has another field (or member variable) called
wearAndTear which is an int in the range of 0 to 10. If wearAndTear is
0, the car runs very efficiently. If it is 10, it won't move. Now,
may be methods of the Car (drive and other methods) need this wearAndTear
information to model the Car properly. Some may modify it internally and
some may use this information. wearAndTear is completely an implementation 
detail and you have no need to have either a setter or a getter method to 
expose this to a user of the Car. Now, when you make a copy of the Car, 
how do you set the wearAndTear of the car. Would you explose the wearAndTear 
of the Car as a public method just for the sake of accessing it between 
objects? 

What is important is to understand the true purpose of Encapsulations.
Then you can decide wisely when and how to use it. 

Once you understand the true intent, one could decide to use methods
as much as possible and access private fields of other objects of the same
class as sparingly as possible for reasons mentioned above in both
of our messages.

>          Also, when I asked today, you mentioned that you don't like the
>way C# and others can defer the constructors from the generic ones to the
>more specific ones, passing default values them.  I really like coding that
>way.  It's very concise to me.  Is there some technical reason why you don't
>like languages to do that, or is it just personal preference?

Not quite exactly what I said. Here is what I said. I do not personally like
calling one constructor from within another constructor. I Java you 
could write two constructors and you may call one from within the other.
That is not some thing I prefer. I would rather write a generic function
and call that from both the constructors. 

Regards,

Venkat

From uhcosc1320-return-30-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 09:44:28 2003
Return-Path: <uhcosc1320-return-30-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DEiP5Z1346227
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 09:44:25 -0500 (CDT)
Received: (qmail 15894 invoked by uid 108); 13 Jul 2003 14:47:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15115 invoked from network); 13 Jul 2003 14:46:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131442.h6DEgjgc1346061@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 09:42:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Bayou (fwd)
Status: O
X-UID: 26
Content-Length: 1198
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>I am confused as to where we need to write the program and can we do it at home.  If so can you tell me how to access Bayou?

As far as the homework is concerned, you can write it any where you want.
You will only turnin a hard copy. 

For the assignment, what you submit should compile at least on one 
of the following compilers:

Visual Studio C++ 6.0
Visual Studio .NET C++ (unmanaged C++ - meaning not the .NET version of C++)
GNU compiler on bayou

The first two will be on PC, the last one is on UNIX (bayou machine).

If you want to use the PCs, you may use the system at your home, office
or at UH CS dept. 

To access bayou, you may logon to bayou.uh.edu. You need an account to
logon to bayou. I have sent an email to Ron Chance of the UH IT dept.
on Thursday requesting for account for each student in the class
and I am waiting for a response from him. I will let you know as soon 
as I hear from him about creating accounts on bayou.  

Please do not hesitate to ask more questions if some thing is not clear.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-31-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 09:47:55 2003
Return-Path: <uhcosc1320-return-31-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DElq5Z1346388
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 09:47:52 -0500 (CDT)
Received: (qmail 17878 invoked by uid 108); 13 Jul 2003 14:51:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15595 invoked from network); 13 Jul 2003 14:46:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131443.h6DEhdDL1346207@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 09:43:39 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question (fwd)
Status: O
X-UID: 27
Content-Length: 349
X-Keywords: $NotJunk                                                                                           

>Can you let us access Bayou.  the computer center said you had to emaail a list of people.
>
>Thank You

I have emailed Ron Chance of that dept. on Thursday and am waiting to hear
from him.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-32-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 09:48:52 2003
Return-Path: <uhcosc1320-return-32-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DEmp5Z1346435
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 09:48:52 -0500 (CDT)
Received: (qmail 18403 invoked by uid 108); 13 Jul 2003 14:52:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12561 invoked from network); 13 Jul 2003 14:40:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131437.h6DEbHpT1345814@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 09:37:17 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assignment 1 and HW 1 posted (fwd)
Status: O
X-UID: 28
Content-Length: 2405
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>  I was reading over the assignment and I got slightly confused by the 
>getNumberofModuloCounters() function. I looked at the output of the 
>assignment and it says number of counters in main and then there is a number 
>of modulo counters in the inner scope...could you please explain this a bit 
>further for me about the number of objects and where you would be counting 
>these things? Thanks a million.

Sure.  We have not discussed about static member variables in class yet.
You may want to read up ahead on that one. We should be talking about
it on Monday in class.

A member variable belongs to an object. For example

class Person
{
private:
	int yearOfBirth;
};

Now, if I create 2 objects of Person, then each will have its own copy
of the yearOfBirth and these values may be same or different. 

A static member variable is shared by all the objects of the class.
It does not belong to any one specific object. Imagine this to be 
some thing that each object can access, but it is common to and shared
by all the objects of the class.

So, if I write

class Person
{
private:
	int yearOfBirth;
	static int numberOfPersons;
};

Now, if I create 4 objects of Person, I have four copies of yearOfBirth
(with different values most likely) in memory. However, I only have
one instance of numberOfPersons in memory and it is shared and is
accessible by all the Person objects. 

You may increment the value of this numberOfPersons in the constructor
and decrement it in the destructor.

For example, I may have
class Person
{
public:
	Person() { numberOfPersons++; }
	~Person() { numberOfPersons-- }
	static int getNumberOfPersons() { return numberOfPersons; }
private:
	static int numberOfPersons;
};

int Person::numberOfPersons = 0;

As a test case, if you write

void main()
{
	cout << Person::getNumberOfPersons() << endl;
	Person p1;
	cout << Person::getNumberOfPersons() << endl;
	Person p2;
	cout << Person::getNumberOfPersons() << endl;
	{
		Person p3;
		cout << Person::getNumberOfPersons() << endl;
	}
	cout << Person::getNumberOfPersons() << endl;
}

The output should be 
0
1
2
3
2

Hope this helps. [of course there is more to the homework than this, but that 
is for you to figure out and learn from it ;) ]

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-34-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 10:18:20 2003
Return-Path: <uhcosc1320-return-34-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DFIK5Z1347661
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 10:18:20 -0500 (CDT)
Received: (qmail 1210 invoked by uid 108); 13 Jul 2003 15:21:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 758 invoked from network); 13 Jul 2003 15:20:47 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131517.h6DFHSuZ1347640@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 10:17:28 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] compiling (fwd)
Status: O
X-UID: 29
Content-Length: 1354
X-Keywords: $NotJunk                                                                                           

>Okay, so I'm working on HW1, the microwave assignment.  There are a
>couple of concerns I have.
>
>We aren't required to use windows, are we?  Because your main.cpp
>#includes <windows.h>, which doesn't exist on my unix systems (both
>solaris 7 and linux).  So, accordingly, Sleep() does not exist.  I had
>to #include <unistd.h> and change it to sleep().  However, sleep()
>sleeps for x seconds, not microseconds or anything.  Hmm, maybe a macro:
>
>#define Sleep(x) sleep((x/1000))

You are correct. If you are using UNIX, you need to use unistd
and not windows.h. The only purpose of windows.h is to get the Sleep method.
If you are using UNIX (or linux), please make the necessary change.

>Also, my compiler requires main to return int.  It won't even compile
>the source file if it doesn't, so I had to change that, also.

As we discussed in class, the ANSI standard requires that main return an
int. It is just that I do not follow that one specific recommendation/
requirement. If you compiler insists, please abide by that standard.

>I'm using sprintf (from stdio.h) since we haven't covered buffered
>strings yet.

You are on the right track.

>When you say turn in a hard copy, I presume we'll come into class with a
>printout and give it to you, right?
>

Yes.

>I think that's it for now.
>
>Thanks...

Alright, keep them comming.

Venkat

From uhcosc1320-return-35-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 10:29:08 2003
Return-Path: <uhcosc1320-return-35-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DFT85Z1348215
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 10:29:08 -0500 (CDT)
Received: (qmail 7029 invoked by uid 108); 13 Jul 2003 15:32:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5945 invoked from network); 13 Jul 2003 15:30:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131526.h6DFQxQc1348112@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 10:26:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Homework 1 question?? (fwd)
Status: O
X-UID: 30
Content-Length: 2552
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat
>
>I am a student in your COSC 1320 class.  I am having some trouble with some of the line in the code you provided for us.
>
>Question 1:
>Why does the line "#include <windows.h> need the ".h" while the line "#include <iostream>" does not?

The iostream refers to the IO library that is part of the 
standard library in C++. windows.h is not part of ANSI standard C++. 

>I was under the impression that if the ".h" was left off that is why the line "using namespace std;" was include in the code.
>In other words if the line "using namespace std;" is use the ".h'' 's are left off the #include lines.  Am I correct?
>

Not quite right. They are some what independent. The using namespace std
simply says that some classes and objects that you are referring to
is from the std namespace.

>Question 2:
>The line "#include <windows.h>", what is that for?  What commands does it pertain to?  I assume it is "Sleep".  Am I correct? 
>

Yes, you are. Please refer to my earlier email to the list on this
issues as well.

>Question 3:
>What does the command Sleep do?  I know it has some thing to do with timing just because I paid attentions when I was retyping the code.
>

The thread that is executing the code will pause for the specified duration
and then resume.

>Question 4:
>Since Sleep is my countdown timer for the Microwave, how do I keep track of the elapsed time for my status method?  Am I suppose to write my
>own function for Sleep?  Or is there something I just don't know about the Sleep command?
>

The sleep simply puts the thread executing main to sleep for the said
duration. Within your microwave, you will keep track of the time when
various methods are called on the Microwave and appropriately 
manage the state of the object.

>I don't know how my program is suppose to know that time has elapsed, without me writing a code that tells my program time has elapsed.  Were is 
>the flaw in my thinking?

Keep thinking. You will have to find the time from the system and
manage this. I will give you more clue on Monday if you still can't 
figure out by then.

>Question 5:
>In the line "return result ? "success" : "failure";, does this line mean if result is true then "success" gets returned rather than a true or 1?  Similarly,
>if result is false is "failure" returned instead of false or 0?  Am I assuming correctly?

You are correct.

>Thanks in advance,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-36-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 10:33:57 2003
Return-Path: <uhcosc1320-return-36-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DFXu5Z1348491
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 10:33:57 -0500 (CDT)
Received: (qmail 9763 invoked by uid 108); 13 Jul 2003 15:37:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7853 invoked from network); 13 Jul 2003 15:33:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131530.h6DFUNZQ1348034@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 10:30:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] a question (fwd)
Status: O
X-UID: 31
Content-Length: 2285
X-Keywords: $NotJunk                                                                                           

>Hello...
> So if we have.......int& b = a
>is 'b' now pointing to 'a' or does 'b' contain the value of 'a'?
>thanks.

No, b now refers to a. That is b and a are one and the same.
It is like saying this is Robert and we call him Bob.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 07/11/03 05:41 AM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] a question (fwd)
>
>> 
>> >could you tell me the difference between & and *?
>>How could I get an idea of how they work?
>
>& and * are used in a couple of different ways and that is 
>confusing at times. First, & is used as AND operation and
>* for multiplication. In this discussion, we will not even
>consider that. We are more interested in the memory related 
>operations.
>
>int* p; // We just defined a pointer. How to know that? Note that
>they type (in this case int) precedes the *. This is true even if you
>write int *p;
>
>Now, consider *p. We have dereferenced the pointer.
>
>This gets the value of the interger variable that is at the address
>pointed by this pointer p. If value of p was 120888, then the value
>at that address is what we are talking about here.
>
>Let's talk about & now.
>
>int a = 5;
>p = &a; // We have taken the address of a. How to know this? Note that
>there is no type before &. 
>
>In this case, p now holds the address of (and hence points to) a.
>
>However, 
>
>int& b = a; // We define a reference named "b" to the variable "a." How to
>know this? note the type (in this case int) is in front of &. This is true
>even if you write int &b = a;
>
>Based on the context of declaration versus usage, you need to understand
>if * is used to define a pointer or to dereference one. Similarly,
>if & is used to get the address or to create a reference.
>
>Hope this helps. Feel free to expand on this and ask further questions
>if some thing is not clear.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-37-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 10:34:58 2003
Return-Path: <uhcosc1320-return-37-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DFYv5Z1348534
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 10:34:57 -0500 (CDT)
Received: (qmail 10419 invoked by uid 108); 13 Jul 2003 15:38:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8843 invoked from network); 13 Jul 2003 15:35:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131532.h6DFWE9Y1348338@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 10:32:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assignment 1 and HW 1 posted (fwd)
Status: O
X-UID: 32
Content-Length: 707
X-Keywords: $NotJunk                                                                                           

>Hello, On the homework, you want us to turn in microwave.h and .cpp.  Can you tell the difference between the file and the difference between .h and .cpp.  Aren't they the same. Please explain and clarify.  Thanks.

The .h contains the interface of the class. The .cpp contains
the implementation of the class. 

For example:

class Microwave
{
public:
	Micrwave();
	... // other things goes here
};

The above will be in Microwave.h.

The following will be in Microwave.cpp

Microwave::Microwave()
{
	//... code
}

//... rest of the methods, etc.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-33-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 09:51:49 2003
Return-Path: <uhcosc1320-return-33-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DEpm5Z1346617
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 09:51:49 -0500 (CDT)
Received: (qmail 19917 invoked by uid 108); 13 Jul 2003 14:55:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19215 invoked from network); 13 Jul 2003 14:53:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131450.h6DEo8XV1346510@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 09:50:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] microwave homework1 (fwd)
Status: O
X-UID: 33
Content-Length: 727
X-Keywords: $NotJunk                                                                                           

>On the first homework about the microwave, do we actually have to have a running process in the background with the microwave or does it just have to look like it's running in the background.
>
>for instance checking if time has run out at each run of another class function.
>

There is really no need to create a thread for this example.
You can simply note the time when start is called. When any
other method is called, you can compare the time at that
instance with the time of start and return an appropriate
response and manipulate the state as needed as well.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-38-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 11:15:29 2003
Return-Path: <uhcosc1320-return-38-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DGFT5Z1350571
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 11:15:29 -0500 (CDT)
Received: (qmail 31430 invoked by uid 108); 13 Jul 2003 16:18:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29376 invoked from network); 13 Jul 2003 16:15:06 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131611.h6DGBlPT1328424@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 11:11:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assignment 1 and HW 1 (fwd)
Status: O
X-UID: 34
Content-Length: 910
X-Keywords: $NotJunk                                                                                           

>Could you please post solutions to previous hw's and
>assignments.  

For those that I have a solution, the solution is already posted.
For others, I do not have a solution to post. Generally I do not
post solutions. I want students to work on those for practise.
You can start a thread of conversation of your solutions to
select problems if you have doubt about any.

>They could be of great help.  I think it
>could help out in trying to figure out how to get
>started with our new assingments, especially for those
>of us that are seeing object oriented programing for
>the first time and feel overwhelmed with so much new
>information.   

That is one of the reasons I write examples in class. Hopefully
those should help you out in that regard.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-39-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 11:16:33 2003
Return-Path: <uhcosc1320-return-39-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DGGX5Z1350557
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 11:16:33 -0500 (CDT)
Received: (qmail 32136 invoked by uid 108); 13 Jul 2003 16:19:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30775 invoked from network); 13 Jul 2003 16:17:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131614.h6DGEMfV1350161@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 11:14:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 1 submission question (fwd)
Status: O
X-UID: 35
Content-Length: 575
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>I wanted to know how we can set up a bayou account to submit our programs. 

This has been discussed in earlier emails, so I will skip this one.

>Also in the assign1.cpp you have written about the coding style and commenting style, do you have an example to show those styles so that I can use them in the program.
>Thanks Alot

Yes, please visit 

http://www.cs.uh.edu/~svenkat/C++CodingStandard/

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-40-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 11:16:45 2003
Return-Path: <uhcosc1320-return-40-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DGGj5Z1350659
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 11:16:45 -0500 (CDT)
Received: (qmail 32312 invoked by uid 108); 13 Jul 2003 16:19:53 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27945 invoked from network); 13 Jul 2003 16:12:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131609.h6DG96hc1350238@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 11:09:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Passing by value and Reference (fwd)
Status: O
X-UID: 36
Content-Length: 1189
X-Keywords: $NotJunk                                                                                           

>hi Venkat,
>
>On this code when a class object is instantiated in main(),
>the values on set() are are passed by value then assign to
>private variable.
>
>Why in the get() these values of private variables are assinged
>to reference variables ?
>
>
>#include "Date.h"
>
>void Date::set(int rmonth, int rday, int ryear)
>{
>	month = rmonth;
>	day = rday;
>	year = ryear;
>}
>
>void Date::get(int& rmonth, int& rday, int* ryear)
>{
>	rmonth = month;
>	rday = day;
>	*ryear = year;
>}

The get (as written above) needs to return three int's to the caller.
There is not way to return these three to the caller (unless you
bundle the three into a struct) by value. So, you are asking
the caller to give you a reference to two ints and a pointer to
the third one (just to illustrate the diff. between ref and pointer)
and the get method fills the two references with the value and
sets the value at the address of pointer to the third value as well.

I am not sure if I answered your question. If I did not, please
rephrase it for me.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-41-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 11:23:02 2003
Return-Path: <uhcosc1320-return-41-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DGN25Z1350898
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 11:23:02 -0500 (CDT)
Received: (qmail 3441 invoked by uid 108); 13 Jul 2003 16:26:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1535 invoked from network); 13 Jul 2003 16:22:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131619.h6DGJMiG1350773@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 11:19:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question on Constructor (fwd)
Status: O
X-UID: 37
Content-Length: 1615
X-Keywords: $NotJunk                                                                                           

>hi,
>having this code
>
>class String2
>{
>public:
>	String2(const char* pval2)
>	{
>		 pRealStr2 = 0;
>		 set(pval2);
>	}
>
>	void set(const char* pval2)
>	{
>		if(pval2 != 0)
>		{
>			delete[] pRealStr2;
>			pRealStr2 = new char[strlen(pval2)+1];
>			strcpy(pRealStr2,pval2);
>        }
>	}
>
>	const char* get()const
>	{
>		return pRealStr2;
>	}
>
>
>private:
>	char * pRealStr2;
>};
>
>
># include <iostream>
># include "String2.h"
>
>using namespace std;
>
>void main()
>{
>	String2 str2;  //("hello there");
>	str2.set("hello there");
>	cout << str2.get() << endl;
>}
>  ??????why  is inappropriate constructor here when I called
>        str2.set() method?
>
>thank you


Look at the code you have above, you should have gotten a compilation
error on the line that says String2 str2;

This is because, the constructor for String requires that you send
a const char* when creating a string object. You are not allowed to
create a String object without giving the initial value.

This is one of the purposes of the constructor. It is to enforce that the
creator will provide necessary information at the point of initialization.

To give you an example, a bank says, we need $100 to create an account.
You may not be able to convince them that they should create an account
with $0 and then you will come back in a day and put $100 in it.

So, at the time of creation, some information is required to be given and
this is enforced by the constructor.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-42-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 11:25:34 2003
Return-Path: <uhcosc1320-return-42-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DGPY5Z1351050
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 11:25:34 -0500 (CDT)
Received: (qmail 4985 invoked by uid 108); 13 Jul 2003 16:28:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2182 invoked from network); 13 Jul 2003 16:23:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307131620.h6DGKesP1350600@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 11:20:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problems running examples from class (fwd)
Status: O
X-UID: 38
Content-Length: 1048
X-Keywords: $NotJunk                                                                                           

>Venkat,
>Sorry to bother with you a tech support question, but I thought you may have
>a quick answer.  I installed the MS Visual C++ Intro edition from the CD in
>the book and now I'm looking at examples from class.  I tried stepping
>through the String Example that you gave us.  I'm getting some errors when I
>try to run the code.  When the debugger gets to this line:
>
>   delete[] pRealStr;
>
>It tells me that it can't find delop.cpp and asks me to find it.  I can't
>find that on my hard drive.  If I comment out that line and try stepping
>through the program again.  It gets to the very next line:
>
>   pRealStr = new char[strlen(pVal) + 1];
>
>and gives me a similar message about not being able to find strlen.cpp.  So
>I'm not sure what to do about this.  Can you offer any suggestions?
>Thanks,

When  you hit these two statements, click on step over instead of
step into.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-43-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 16:03:12 2003
Return-Path: <uhcosc1320-return-43-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DL3C5Z1363540
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 16:03:12 -0500 (CDT)
Received: (qmail 31146 invoked by uid 108); 13 Jul 2003 21:06:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30958 invoked from network); 13 Jul 2003 21:06:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307132102.h6DL2gNJ1363502@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 16:02:42 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] COSC 1320 (fwd)
Status: O
X-UID: 39
Content-Length: 1061
X-Keywords: $NotJunk                                                                                           

>Venkat,

Hi,

Please write an appropriate email subject. For example, 
"Help with compiler error" or some thing even more specific if possible.

>      I have a problem when compiling my hw1 on Microsoft Visual C++ 6.0 and I hope you can help. The compiler keeps giving me an error for this line of code in the function printStatus(Microwave& m) in main.cpp:
>   
> 
>                              cout << m.status() << endl:
> 
>This is the error it gives me:
> 
>         error C2679: binary "<<" : no operator defined which takes a right-hand operand of type 'void' (or there is no acceptable conversion)
> 
>Could you please tell me what I am doing wrong or is there something wrong with the compiler?
>                                                         Thanks a lot.

Does your status method return a void by any chance? If it does, modify
it to return a const char* and that should fix it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-44-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 16:09:43 2003
Return-Path: <uhcosc1320-return-44-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DL9h5Z1363506
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 16:09:43 -0500 (CDT)
Received: (qmail 2581 invoked by uid 108); 13 Jul 2003 21:12:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31859 invoked from network); 13 Jul 2003 21:07:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307132104.h6DL4AY21363588@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 16:04:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] COSC 1320 (fwd)
Status: O
X-UID: 40
Content-Length: 336
X-Keywords: $NotJunk                                                                                           

>Venkat,
>     I finally figured out what I was doing wrong right after I sent you that e-mail. Sorry to have wasted your time.
>                                               Thanks.

No problem at all. For some people, my email box works as a magic
box. As soon as they send me the mail, they seem to figure out the
solution.

Venkat

From uhcosc1320-return-45-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 16:10:18 2003
Return-Path: <uhcosc1320-return-45-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DLAH5Z1364077
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 16:10:18 -0500 (CDT)
Received: (qmail 3013 invoked by uid 108); 13 Jul 2003 21:13:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32745 invoked from network); 13 Jul 2003 21:09:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307132105.h6DL5iBu1363732@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 16:05:44 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] compiling (fwd)
Status: O
X-UID: 41
Content-Length: 517
X-Keywords: $NotJunk                                                                                           

>Regarding turning in the homework, I thought we needed to turn a copy of the program in, either by email or disks, instead of a paper printout of the program.  Thanks.

For the homeworks, a hard copy is needed (no email submissions or disks will
be accepted).

For assignments, you will turn in the program electronically. Instructions
will be given later. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-46-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 16:11:54 2003
Return-Path: <uhcosc1320-return-46-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DLBr5Z1364176
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 16:11:54 -0500 (CDT)
Received: (qmail 3929 invoked by uid 108); 13 Jul 2003 21:15:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2288 invoked from network); 13 Jul 2003 21:12:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307132109.h6DL98851363856@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 16:09:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] class (fwd)
Status: O
X-UID: 42
Content-Length: 1002
X-Keywords: $NotJunk                                                                                           

>I know this may be annonyin to answer, but could you please explain to me the purpose of having a class.  Also, is there any difference between classes and structures.  Thanks a lot.

The purpose of a class is to represent a model so that the data and the
behavior of that model can be bundled together so as to provide an 
easier and robust way to use.

In C++, struct and class more or less serve the same purpose. The
differences are, by default, members of a class are private (unless
specified otherwise as public or protected) and members of a struct
are public (unless specified otherwise).

class A
{
	int v; // v is private
};

struct B
{
	int v; // v is public
};

Generally, people would use class to represent the OO concept of class and
struct to hold simply data with no behavior. One should use struct as
sparingly as possible.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-47-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 16:29:59 2003
Return-Path: <uhcosc1320-return-47-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DLTw5Z1365152
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 16:29:58 -0500 (CDT)
Received: (qmail 14323 invoked by uid 108); 13 Jul 2003 21:33:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13629 invoked from network); 13 Jul 2003 21:32:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307132128.h6DLSeTk1365045@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 16:28:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Memory leak
Status: O
X-UID: 43
Content-Length: 1839
X-Keywords: $NotJunk                                                                                           

In an earlier email a few days ago I had said that I will send an example
of memory leak this weekend. Here it is.

prog < inputRelease 
produces the following output:
Enter number of iterations
Enter size of int array to create per iteration  
Enter 1 if you want to deallocate memory each iteration; 0 otherwise 
*******************************************
Iterations 100 size 1000000 release 1
Each iteration will use 3.8147 MB
Begining creation on heap
done

prog < inputNoRelease
produces the following output:
Enter number of iterations
Enter size of int array to create per iteration  
Enter 1 if you want to deallocate memory each iteration; 0 otherwise 
*******************************************
Iterations 100 size 1000000 release 0
Each iteration will use 3.8147 MB
Begining creation on heap
Abort process

The file inputRelease contains:
100
1000000
1

The file inputNoRelease contains:
100
1000000
0

And finally the prog.cpp is
#include <iostream>

using namespace std;

void main()
{
	int iterations;
	bool release;
	int size;

	cout << "Enter number of iterations" << endl;
	cin >> iterations;

	cout << "Enter size of int array to create per iteration  " << endl;
	cin >> size;

	cout << "Enter 1 if you want to deallocate memory each iteration; 0 otherwise " << endl;
	cin >> release;

	cout << "*******************************************" << endl;
	cout << "Iterations " << iterations << " size " << size <<
		" release " << release << endl;
	cout << "Each iteration will use " << (size * 4.0) / (1024 * 1024)  << " MB" << endl;
	cout << "Begining creation on heap" << endl;
	for(int i = 0; i < iterations; i++)
	{
		int* p = new int[size];

		if (release) delete[] p;
	}
	cout << "done" << endl;
}


The above results were from bayou. Depending on the system in which you 
run the program, results may vary.

Venkat

From uhcosc1320-return-48-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 16:44:41 2003
Return-Path: <uhcosc1320-return-48-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DLie5Z1365749
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 16:44:40 -0500 (CDT)
Received: (qmail 22215 invoked by uid 108); 13 Jul 2003 21:47:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21240 invoked from network); 13 Jul 2003 21:46:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307132142.h6DLghPs1365630@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 16:42:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Early Homework (fwd)
Status: O
X-UID: 44
Content-Length: 368
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>There is a possibility that I will not be able to attend Wednesday =
>night's class.  Can homework be turned in early?
>

Absolutely. Please make sure you hand it to me directly when you are
ready.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-49-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 13 16:50:28 2003
Return-Path: <uhcosc1320-return-49-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6DLoR5Z1366021
	for <cosc155g@bayou.uh.edu>; Sun, 13 Jul 2003 16:50:28 -0500 (CDT)
Received: (qmail 25191 invoked by uid 108); 13 Jul 2003 21:53:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21888 invoked from network); 13 Jul 2003 21:47:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307132143.h6DLhx5P1365675@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 13 Jul 2003 16:43:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] microwave homework1 , do we have to use time.h ... (fwd)
Status: O
X-UID: 45
Content-Length: 492
X-Keywords: $NotJunk                                                                                           

>Hi,
>
>Whether in separate thread or as you have suggested finding time diff at
>two different instances, do we have to make use of time.h and time_t and
>time() function or do we have a time class in C++ standard library ?
>
>Thank you,

Yes, you will #include <time.h> and then call

__time64_t currentTime;
_time64(&currentTime);

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-50-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 14 01:32:09 2003
Return-Path: <uhcosc1320-return-50-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6E6W85Z1389474
	for <cosc155g@bayou.uh.edu>; Mon, 14 Jul 2003 01:32:09 -0500 (CDT)
Received: (qmail 20013 invoked by uid 108); 14 Jul 2003 06:35:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18308 invoked from network); 14 Jul 2003 06:31:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307140628.h6E6SaF91389316@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 14 Jul 2003 01:28:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] just a quick q (fwd)
Status: O
X-UID: 46
Content-Length: 865
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>In one of the e-mails  you suggested that the assignments should be =
>compiled with either Visual Studio C++ 6.0, Visual Studio .NET C++ =
>(unmanaged C++ - meaning not the .NET version of C++) or GNU compiler on =
>bayou I do not have those I have dev-c++ can I still use it... another =
>question .... on the microwave assignment what is the difference between =
>.h and .cpp and how do you make a file or project on dev c++ (this is my =
>first time taking c++ I really don't know the dev system)

I will test your assignment by compiling in one of the three compilers
that I have mentioned. As long as your code works fine in one of these,
it does not matter using which you developer.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-51-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 14 01:32:47 2003
Return-Path: <uhcosc1320-return-51-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6E6Wl5Z1389402
	for <cosc155g@bayou.uh.edu>; Mon, 14 Jul 2003 01:32:47 -0500 (CDT)
Received: (qmail 20408 invoked by uid 108); 14 Jul 2003 06:35:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17697 invoked from network); 14 Jul 2003 06:30:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307140627.h6E6RBWo1389053@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 14 Jul 2003 01:27:11 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Examples from class... (fwd)
Status: O
X-UID: 47
Content-Length: 337
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>Can you post the link where you uploaded the examples that you did in class?
>
>Thanks.

Sure. The URL is

http://www.cs.uh.edu/~svenkat/summer2003/ExamplesFromClass

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-52-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 14 01:34:33 2003
Return-Path: <uhcosc1320-return-52-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6E6YW5Z1389602
	for <cosc155g@bayou.uh.edu>; Mon, 14 Jul 2003 01:34:32 -0500 (CDT)
Received: (qmail 21468 invoked by uid 108); 14 Jul 2003 06:37:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18839 invoked from network); 14 Jul 2003 06:33:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307140629.h6E6TehF1389049@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 14 Jul 2003 01:29:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] changes to assign1.cpp in order to compile (fwd)
Status: O
X-UID: 48
Content-Length: 634
X-Keywords: $NotJunk                                                                                           

>Venkat,
>          I've had to make the following changes to assign1.cpp in order to
>get it to compile on my system.
> 
>#include <iostream>
>#include "ModuloCounter.h"
> 
>using namespace std;
> 
>Otherwise, the compiler can't find the original <iostream.h> in the cpp
>file.  I had to remove the ".h" from iostream and add the "using..."
>statement.

I would expect this to be the case if you are using the VS.NET version.
No problem. That is pretty reasonable to change.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-53-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 14 01:38:50 2003
Return-Path: <uhcosc1320-return-53-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6E6co5Z1389857
	for <cosc155g@bayou.uh.edu>; Mon, 14 Jul 2003 01:38:50 -0500 (CDT)
Received: (qmail 23767 invoked by uid 108); 14 Jul 2003 06:42:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22504 invoked from network); 14 Jul 2003 06:39:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307140636.h6E6a3Vo1389685@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 14 Jul 2003 01:36:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] _time64 (fwd)
Status: O
X-UID: 49
Content-Length: 429
X-Keywords: $NotJunk                                                                                           

>Hi,
>
>What's the difference between _time64 and time?  I already finished writing 
>my program using time, do you want me to change it so that it uses _time64?
>Also, I included ctime...any problems?

Using time is just fine and infact it is part of the ANSI standard.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-55-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 07:41:00 2003
Return-Path: <uhcosc1320-return-55-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FCf05Z1559593
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 07:41:00 -0500 (CDT)
Received: (qmail 22345 invoked by uid 108); 15 Jul 2003 12:44:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21813 invoked from network); 15 Jul 2003 12:43:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151240.h6FCe7l41564295@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 07:40:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Midterm 1 on Monday
Status: O
X-UID: 50
Content-Length: 369
X-Keywords: $NotJunk                                                                                           

Greetings,

Midterm 1 will be held on Monday in class. There will be an optional
review (options as in you are not required to attend) on Saturday
2PM - 3PM (or as long as you want to ask questions). 

Regards,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-54-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 14 01:52:27 2003
Return-Path: <uhcosc1320-return-54-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6E6qR5Z1390554
	for <cosc155g@bayou.uh.edu>; Mon, 14 Jul 2003 01:52:27 -0500 (CDT)
Received: (qmail 30538 invoked by uid 108); 14 Jul 2003 06:55:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17385 invoked from network); 14 Jul 2003 06:29:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307140626.h6E6QbYB1389169@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 14 Jul 2003 01:26:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] microwave homework1 , (fwd)
Status: O
X-UID: 51
Content-Length: 373
X-Keywords: $NotJunk                                                                                           

>Hi,
>
>I getting ERROR : '__time64_t' : missing storage-class or type
>specifiers
>If I use __time64_t. Do I have to change any compiler settings for
>time.h ?
>
>Thank you,

Which compiler are you using? 

Venkat

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-56-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:00:33 2003
Return-Path: <uhcosc1320-return-56-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FD0X5Z1067735
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:00:33 -0500 (CDT)
Received: (qmail 3184 invoked by uid 108); 15 Jul 2003 13:03:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2877 invoked from network); 15 Jul 2003 13:03:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151259.h6FCxxAe1067070@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 07:59:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320]hw 1  memory leak (fwd)
Status: O
X-UID: 52
Content-Length: 1082
X-Keywords: $NotJunk                                                                                           

>Hi Dr. Venkat,

One final time, no need to address me as Dr.

>I was writing the code for the status() function in
>HW1 and noticed that the return type is char*.  

Actually, it should be const char*.

>When the function returns the  output as "Microwave is .."
>, is the char* string created on the stack or on the
>heap. 

This is for you to decide.

>Also I wanted to know how to avoid memory leak in the
>following example. Let us say we have a function say
>foo_method as
>
>
>const char & myClass :: foo_method() 
>{ 
>  char * myStr;
>  myStr = new char[];
>  ...
>  return myStr;
>}
>
>In this case I am not deleting the myStr char [] which
>is created on the heap beacuse I am returning the
>string and I can not delete before returning it. I can
>not delete after I return it. So how can I avoid
>memory leak?
>
>Thanks

You may make the pointer a member of the class and delete it
in the destructor eventually.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-57-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:05:12 2003
Return-Path: <uhcosc1320-return-57-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FD5C5Z1073427
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:05:12 -0500 (CDT)
Received: (qmail 6522 invoked by uid 108); 15 Jul 2003 13:08:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4126 invoked from network); 15 Jul 2003 13:04:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151301.h6FD1UbI1068873@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:01:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] time_t and header files (fwd)
Status: O
X-UID: 53
Content-Length: 632
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>When writing the Microwave.h file, I am storing the time the microwave =
>started in a private variable.  Should I store it as a type time_t or as =
>a long?  If I store it as a type time_t, do I need to include the time.h =
>header file at the top of the Microwave.h file?
>
>Thank you,

Either way is fine. I would prefer to use time_t since that is the type
the time function is dealing with (and allows for any future changes
to be accomodated more easily).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-58-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:08:01 2003
Return-Path: <uhcosc1320-return-58-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FD805Z1076945
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:08:00 -0500 (CDT)
Received: (qmail 8718 invoked by uid 108); 15 Jul 2003 13:11:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7823 invoked from network); 15 Jul 2003 13:10:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151306.h6FD6UKC1075124@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:06:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] sleep method (fwd)
Status: O
X-UID: 54
Content-Length: 687
X-Keywords: $NotJunk                                                                                           

>Could you please explain how the sleep method works. 
>I have an idea but I'm not sure how to call it or if
>we're supposed to write a function for it.  Thanks.

The sleep function simply pauses the calling thread for the
specified duration. It is provided in a library. You will
simply use it and you do not have to write the sleep method.
Within your microwave you will not use sleep either. 
This is simply for the main to pause while using the 
Microwave object (a way to introduce time delay while the program
is running).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-59-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:10:35 2003
Return-Path: <uhcosc1320-return-59-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDAZ5Z1080092
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:10:35 -0500 (CDT)
Received: (qmail 10696 invoked by uid 108); 15 Jul 2003 13:13:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5905 invoked from network); 15 Jul 2003 13:07:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151304.h6FD4AcZ1072244@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:04:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] how do I compile in Bayou (fwd)
Status: O
X-UID: 55
Content-Length: 1081
X-Keywords: $NotJunk                                                                                           

><DIV>Hi Mr. Venkat</DIV>
><DIV>&nbsp;</DIV>
><DIV>I have a question. I know to compile in bayou if you have a simple simple program without classes then you can use cxx name.cpp and then use ./a.out but what happens if you classes like in Hmwk1 where there is Microwave.h and Microwave.cpp. I tried using cxx hmwk1.cpp, that is the name of my main file. But the bayou compiler says </DIV>
><DIV>Unresolved:</DIV>
><DIV>Microwave::start...</DIV>
><DIV>and so on for the rest of the functions in the Microwave.cpp file</DIV>
><DIV>&nbsp;</DIV>
><DIV>I checked if I included Microwave.h in the Microwave.cpp file and I have it there. </DIV>
><DIV>I don't know what is wrong. Can you please help me</DIV>
><DIV>Thanks</DIV>

Sure.

cxx -c Microwave.cpp
The above creates the object file Microwave.o.

cxx -o hw1 Hw1.cpp Microwave.o
The above creates hw1 executable which will have Hw1.cpp compiled and 
Microwave.o linked in.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-60-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:13:36 2003
Return-Path: <uhcosc1320-return-60-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDDa5Z1084123
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:13:36 -0500 (CDT)
Received: (qmail 13167 invoked by uid 108); 15 Jul 2003 13:16:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11344 invoked from network); 15 Jul 2003 13:14:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151311.h6FDB4db1080949@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:11:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] what is inline? (fwd)
Status: O
X-UID: 56
Content-Length: 1151
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>in the Microwave program there is the function printbool has inline before it
>inline const char* printBool(bool result)
>
>what is inline???
>thanks alot

If a function is marked inline, then the call overhead to it is eliminated.

For example, if I have

inline int foo(int a)
{
	return a * a;
}

Now, if I have

int v = 4;
int z = 2;
int b, c;

b = foo(v);
c = foo(z);

The above code will not incur any method call to foo at all.
The compiler while generating the assembly, will create code that
is equivalent to the following:

int v = 4;
int z = 2;
int b, c;

b = v * v;
c = z * z;

Notice how the place where foo was called, the method call has been
replaced with the expanded contents of the method.

Inline functions behave like macros in terms of how they are expaned,
but apply all the precedence rules that functions use. The expansion
of macro is done by the pre-processor which is not that intelligent.
The expansion of a inline method is done by the compiler.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-61-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:17:32 2003
Return-Path: <uhcosc1320-return-61-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDHV5Z1089059
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:17:31 -0500 (CDT)
Received: (qmail 16118 invoked by uid 108); 15 Jul 2003 13:20:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13029 invoked from network); 15 Jul 2003 13:16:45 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151313.h6FDDGG21083708@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:13:16 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problems opening Examples (fwd)
Status: O
X-UID: 57
Content-Length: 501
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>   I am having trouble opening the .zip file for the examples in 
>class...could you help me out? I am not sure why it is not opening...
>
>thanks

You may want to use the latest version of Winzip. A free copy may be
downloaded from http://www.winzip.com.

If it still does not work, send me details on the error you are getting.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-62-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:19:57 2003
Return-Path: <uhcosc1320-return-62-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDJu5Z1091948
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:19:56 -0500 (CDT)
Received: (qmail 18060 invoked by uid 108); 15 Jul 2003 13:23:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14811 invoked from network); 15 Jul 2003 13:19:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151315.h6FDFUSG1084909@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:15:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Examples from Class (fwd)
Status: O
X-UID: 58
Content-Length: 349
X-Keywords: $NotJunk                                                                                           

>hi Venkat
>
>could u plase create a link to "examples from class"
>in the main page of the course COSC1320?
>
>Thanks

Sure. It is up there now at 

http://www.cs.uh.edu/~svenkat/summer2003

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-63-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:23:29 2003
Return-Path: <uhcosc1320-return-63-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDNS5Z1096613
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:23:29 -0500 (CDT)
Received: (qmail 21237 invoked by uid 108); 15 Jul 2003 13:26:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17578 invoked from network); 15 Jul 2003 13:22:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151319.h6FDJ5Xs1091084@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:19:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] getting error with time() (fwd)
Status: O
X-UID: 59
Content-Length: 1075
X-Keywords: $NotJunk                                                                                           

><html><div style='background-color:'><DIV>Hi Mr. Venkat</DIV>
><DIV>&nbsp;</DIV>
><DIV>I still have that problem of unresolved: Microwave::start().... but what I did was to see if my program is running I combined the implementation with the .h file. It doesn't have the unresolve error any more but I have a new error. it says that expression must have (pointer-to-) function type. </DIV>
><DIV>and it points to "t" in time(currentTime);</DIV>
><DIV>Where currentTime is a pointer of type time_t</DIV>
><DIV>"time_t* currentTime=0;"</DIV>
><DIV>&nbsp;</DIV>
><DIV>Whereas when I wrote a small trial program the same thing works and gives my current time in seconds. </DIV>
><DIV>&nbsp;</DIV>
><DIV>Can you please help me. </DIV>
><DIV>Thanks</DIV>

You would write some thing like

time_t currentTime;
time(&currentTime);

If it does not work, email me the actual code you have writte and 
I will take a look at it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-64-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:34:31 2003
Return-Path: <uhcosc1320-return-64-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDYV5Z1110663
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:34:31 -0500 (CDT)
Received: (qmail 32268 invoked by uid 108); 15 Jul 2003 13:37:53 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26858 invoked from network); 15 Jul 2003 13:31:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151327.h6FDRXCu1101844@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:27:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Monday Lecture (fwd)
Status: O
X-UID: 60
Content-Length: 2719
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
> 
>Thank you very much for taking your time to read over the emails of the
>students, your responses have really helped me to a better understanding
>of the concepts you are teaching all of us.

I am glad it is useful.

>Going over my notes for today's lecture, I stumbled upon some minor
>inquiries.
> 
>Can you please explain (again) the concept/purpose of "inline" in the
>main.cpp of HW1? 
> 

I just sent out another email on this topic. Please refer to that and
get back if you have more questions.

>Also we learned today, that every time a constructor is called, a
>destructor should also be called eventually.

Correct it as "the" destructor instead of "a" destructor. There is
only one destructor in a class.

>Therefore for every constructor we build, we should immediately create a
>destructor? If this is the case, then should we apply that in our HW1?

While you can have any number of constructors, you are allowed to 
have only one destructor in a class. 
 
>Can you please elaborate on the two types of methods: query and
>modifiers? Is the only difference: one is found in public, the other in
>private, or am I completely wrong?
 
A query method is one that does not modify the state of an object.
Modifiers do. You generally make the query method a const method
by placing "const" at the far right of the method signature.

>An example you used today, to show demonstrate NOT TO PASS A METHOD BY
>VALUE:
> 
>Void foo(const X& obj)
>{
>   ..
>}
> 
>X obj1;
>foo(obj1);
> 
>Why isn't the line that contains the call of foo written : foo(&obj1)?
>Is void expecting a reference to a method?

When calling a method, you will send the address of an object 
(like &obj1) only if the function takes a pointer (like
someFunction(X* p) ). foo in the above example is not taking a pointer.
It is taking a reference. So, you are sending the object itself and
not an address.

Here is how I create a pointer to obj1.

X* ptr = &obj1;

Here is how I create a reference to obj1.

X& ref = obj1;

Now, ref is just an alias, or another name for obj1. Similarly, in foo,
when foo(obj1) is called, obj is a reference or alias to obj1.

>Finally, would you be able to go over debugging in class, there are some
>nice tricks you use in class to elaborate on some concepts, and I think
>as the class goes on, debugging the examples will be very helpful for
>reviewing purposes.
> 
>Thanks again for your time!
> 
>Best regards,

Absolutely. Let's do that today in class towards the end of the current
session (chapter). Please remind me if I forget.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-65-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:37:19 2003
Return-Path: <uhcosc1320-return-65-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDbJ5Z1114034
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:37:19 -0500 (CDT)
Received: (qmail 2296 invoked by uid 108); 15 Jul 2003 13:40:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32009 invoked from network); 15 Jul 2003 13:37:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151334.h6FDY4xY1110138@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:34:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] microwave homework1  Cosc 1320 (fwd)
Status: O
X-UID: 61
Content-Length: 1769
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I understand the need for implementing the class in microwave.cpp.  How
>exactly, when you call the time function and store it in a value, do you
>get that information to the other function?  Specifically, you're going
>to get the system time for the start function.  The stop function will
>take the time that was stored in the start and subtract it from the stop
>time.  Do you pass the information by reference from one function to the
>other? Or by pointer?

If a variable is a member variable of a class, then it is available
for access by all the methods of the class.

Here is an example:

//A.h
class A
{
public:
	A();
	void add(int val);
	int get() const;
private:
	int v;
};

//A.cpp
#include "A.h"
A::A() 
{
	v = 0;
}

void A::add(int val)
{
	v = v + val;
}

int A::get() const
{
	return v;
}

Now, lets say I have

//main.cpp
#include "A.h"
void main()
{
	int value;
	A obj;

	obj.add(2);
	value = obj.get(); 
	obj.add(3);
	value = obj.get(); 
}

When obj is created, the private variable v within A is initialized to
0 by the constructor of A. That stays in memory. When add is called,
that same variable v is modified to 2 (by adding 0 and 2). When get
is called, a copy of that v is returned to main to store in value.
When add is called again, that variable v is modified to 5. 

Here is a way to think about it. Assume I have a notepad on my hand.
On the notepad, I have written 0. Now you call add(2) on me, I will
modify the 0 to 2. Now, if you call get, I will return 2. If you call
add(3), I will modify the 2 to a 5 now. This is kind of what the object
does.

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-66-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:37:21 2003
Return-Path: <uhcosc1320-return-66-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDbL5Z1114147
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:37:21 -0500 (CDT)
Received: (qmail 2454 invoked by uid 108); 15 Jul 2003 13:40:39 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15875 invoked from network); 15 Jul 2003 13:20:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151316.h6FDGv3c1088391@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:16:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] follow coding standards on Homeworks? (fwd)
Status: O
X-UID: 62
Content-Length: 472
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>I just wanted to know if we need to follow the coding standards for the homeworks or just for the assignments.  If not, do we still need to include comments in the homeworks? Please let me know asap. Thanks.

Those are for all things you will turnin towards this course -
homeworks and assignments.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-67-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:42:07 2003
Return-Path: <uhcosc1320-return-67-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDg65Z1120445
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:42:06 -0500 (CDT)
Received: (qmail 6541 invoked by uid 108); 15 Jul 2003 13:45:19 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1053 invoked from network); 15 Jul 2003 13:39:18 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151335.h6FDZnkZ1112331@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:35:49 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] C++ Book (fwd)
Status: O
X-UID: 63
Content-Length: 489
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
> 
>I found this book on the web, it is FREE! It might interest some
>students in the COSC 1320 class.
> 
>http://mindview.net/Books/TICPP/ThinkingInCPP2e.html
> 
>Regards,

Thanks for the information.

Bruce is a great author. I stronly recommend reading this book
if you want to get a great deal of OO fundamentals.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-68-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:51:56 2003
Return-Path: <uhcosc1320-return-68-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDpu5Z1132691
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:51:56 -0500 (CDT)
Received: (qmail 15290 invoked by uid 108); 15 Jul 2003 13:55:19 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6221 invoked from network); 15 Jul 2003 13:45:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151341.h6FDfXfK1119815@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:41:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] hom1ques. (fwd)
Status: O
X-UID: 64
Content-Length: 510
X-Keywords: $NotJunk                                                                                           

>Dr Venkat,
>when i run my program it keeps on giving me 90 seconds left all the time.i 
>read in one of your emails that we should use time.h and then call some other 
>time functions, can you please clarify that a little bit more and how to use it?
>Thnak you.

I just sent a sample that uses time. Hopefully that will help clarifying
your question.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-69-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:54:27 2003
Return-Path: <uhcosc1320-return-69-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDsR5Z1135975
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:54:27 -0500 (CDT)
Received: (qmail 17499 invoked by uid 108); 15 Jul 2003 13:57:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13149 invoked from network); 15 Jul 2003 13:52:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151349.h6FDnLXX1129547@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:49:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] HI, it's just a ques about status func (fwd)
Status: O
X-UID: 65
Content-Length: 711
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>I think this is kinda silly to ask but can u suggest me anyway to write the status function in a proper way because mine doesn't work and it doesnt return the number of seconds left also. 
>Thanks,.......
> 
>
... code deleted ...

Here is part of the code for status:

//..... compute secondsLeft here.
if (isStillRunning)
{
	sprintf(msg, "Microwave in use. %d seconds left", secondsLeft);
	return msg;
}
else
{
	return "Microwave not in use";
}

Where msg is declared as char* msg within the class (private member
variable) and is initialized within the constructor as 
msg = new char[100]. secondsLeft is declared within the status
and computed as well. Code for that is not shown here.

Venkat

From uhcosc1320-return-70-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:56:07 2003
Return-Path: <uhcosc1320-return-70-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDu75Z1138047
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:56:07 -0500 (CDT)
Received: (qmail 18983 invoked by uid 108); 15 Jul 2003 13:59:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5367 invoked from network); 15 Jul 2003 13:44:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151340.h6FDeZ0g1118403@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:40:35 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Homework#1 - time functions (fwd)
Status: O
X-UID: 66
Content-Length: 1102
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>I can't figure out how to use the functions included in <time.h>.  I've tried to look it up in some of my books but I didn't find out anything useful about it.  Can you please explain it as far as what it is used for and its syntax.  Also, i'm not quite sure I understand the effect of the Sleep function on our program.  I know you said it puts the main to "sleep" but what good does that do?  Sorry if you've already answered any of these questions.  Thanks for your help.
>

Here is a sample that uses time:
#include <iostream>
#include <time.h>
using namespace std;

void main()
{
	char str[100];

	cout << "I am going to tell you how long you took to type the word blahblah" << endl;

	
	time_t start;
	time_t end;

	time(&start);
	cin >> str;
	time(&end);

	if (strcmp(str, "blahblah"))
		cout << "You did not enter blahblah" << endl;
	else
		cout << "You took " << end - start << " seconds!" << endl;
}

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-71-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:57:42 2003
Return-Path: <uhcosc1320-return-71-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDvg5Z1139863
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:57:42 -0500 (CDT)
Received: (qmail 20592 invoked by uid 108); 15 Jul 2003 14:01:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16186 invoked from network); 15 Jul 2003 13:56:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151352.h6FDqsiP1134144@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:52:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Visual Studio 6.0 part of your book?
Status: O
X-UID: 67
Content-Length: 364
X-Keywords: $NotJunk                                                                                           

Hi

A generous person in the class brought to my attention that 
Visual Studio 6.0 is part of the book (it is in the CD attached to
the book). So if you want to use VS 6.0, you got it if you have the
book.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-72-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 08:59:48 2003
Return-Path: <uhcosc1320-return-72-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FDxm5Z1142743
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 08:59:48 -0500 (CDT)
Received: (qmail 22607 invoked by uid 108); 15 Jul 2003 14:03:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14702 invoked from network); 15 Jul 2003 13:54:39 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151351.h6FDp9oI1131818@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:51:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] using namespace std; (fwd)
Status: O
X-UID: 68
Content-Length: 852
X-Keywords: $NotJunk                                                                                           

>I place the following statement...  using namespace std; in my main.cpp and when I compile it, it says I'm missing a ';' before 'using'.  So I place a ';' right before 'using' and the error goes away.  Is anything wrong with this picture.  My heading in the main.cpp looks as follows:
>
>#include <iostream>
>#include <time.h>
>#include <windows.h>
>#include "Microwave.h"
>
>using namespace std;
>
>
>
>void main (){....
>
>Is there some kind of bugs in my program or is there something wrong with my complier?  Thank you.

You may want to make sure that a ; is present after the } at the
end of your Microwave class. That is

class Microwave
{
...
}; // Make sure this semicolon is present.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-73-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 09:26:19 2003
Return-Path: <uhcosc1320-return-73-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6FEQI5Z1175342
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 09:26:18 -0500 (CDT)
Received: (qmail 13732 invoked by uid 108); 15 Jul 2003 14:29:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8208 invoked from network); 15 Jul 2003 13:47:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307151343.h6FDheqj1122431@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 08:43:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] homework1 (fwd)
Status: O
X-UID: 69
Content-Length: 1058
X-Keywords: $NotJunk                                                                                           

>On the status function that we create, it apparently does not have any inputs as shown from the guidelines on the homework.  But, what is the return type of the check status function, when we see if the microwave is in use or not.  I figured that it's probably some sort of string because it should tell the user if its in use or not, but I question myself on that judgement because on the guidelines on this homework, you have
>
>void printStatus(Microwave & m)
>         cout << m.status() << endl;
>
>Instead of void printStatus....... is it suppose to be const char *  ???  But if its a  "const char*", will it still print to the screen?
>Can you please help me out.  Thanks.

You are consusing what your function should be with the signature of
the printStatus method.

Your Microwave's status method should return a const char*.

That const char* is taken by cout and printed on the terminal.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-74-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:04:49 2003
Return-Path: <uhcosc1320-return-74-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G44m5Z1255409
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:04:49 -0500 (CDT)
Received: (qmail 4875 invoked by uid 108); 16 Jul 2003 04:08:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2668 invoked from network); 16 Jul 2003 04:04:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160401.h6G41M4K1250228@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:01:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] macros (fwd)
Status: O
X-UID: 70
Content-Length: 581
X-Keywords: $NotJunk                                                                                           

>I am not sure if I'm suppose to know what macros are by this time, but can you please explain to me what macros are?  Thanks.

Macros are from the C language syntax. They are substituited by
the pre-processor. Here are examples of macros:

#define MAX 100
#define Square(X) (X) * (X)

Now, in the code if I have

int val = MAX;
int a = Square(val);

The compiler would replace this with

int val = 100;
int a = val * val;

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-75-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:05:47 2003
Return-Path: <uhcosc1320-return-75-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G45l5Z1258193
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:05:47 -0500 (CDT)
Received: (qmail 5555 invoked by uid 108); 16 Jul 2003 04:09:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 671 invoked from network); 16 Jul 2003 04:01:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160358.h6G3wQaL1247073@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 22:58:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] A question about status method (fwd)
Status: O
X-UID: 71
Content-Length: 503
X-Keywords: $NotJunk                                                                                           

>I am another student. I saw the code below in your email but I did in a different way. I declared a static char array message[100] in the status function to store the message. Is this correct
> 
>Thanks

Sorry, this will be a problem. If I create two or more microwaves and 
call status on each one of them, the same message variable within
static will be used for all the calls and this may lead to problems.

In generally, be very careful in putting static variables within
instance methods.

Venkat

From uhcosc1320-return-76-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:08:01 2003
Return-Path: <uhcosc1320-return-76-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4815Z1262306
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:08:01 -0500 (CDT)
Received: (qmail 7148 invoked by uid 108); 16 Jul 2003 04:11:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4277 invoked from network); 16 Jul 2003 04:07:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160403.h6G43mEe1255719@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:03:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] using namespace std; (fwd)
Status: O
X-UID: 72
Content-Length: 1246
X-Keywords: $NotJunk                                                                                           

>So that petty little error is what killed so much of my time.

That's like life in big city! :)

Venkat

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 07/15/03 08:51 AM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] using namespace std; (fwd)
>
>> 
>> >I place the following statement...  using namespace std; in my main.cpp
>and when I compile it, it says I'm missing a ';' before 'using'.  So I place
>a ';' right before 'using' and the error goes away.  Is anything wrong with 
>this picture.  My heading in the main.cpp looks as follows:
>>
>>#include <iostream>
>>#include <time.h>
>>#include <windows.h>
>>#include "Microwave.h"
>>
>>using namespace std;
>>
>>
>>
>>void main (){....
>>
>>Is there some kind of bugs in my program or is there something wrong with 
>my complier?  Thank you.
>
>You may want to make sure that a ; is present after the } at the
>end of your Microwave class. That is
>
>class Microwave
>{
>...
>}; // Make sure this semicolon is present.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475

From uhcosc1320-return-77-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:08:03 2003
Return-Path: <uhcosc1320-return-77-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4825Z1262235
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:08:02 -0500 (CDT)
Received: (qmail 7294 invoked by uid 108); 16 Jul 2003 04:11:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3089 invoked from network); 16 Jul 2003 04:05:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160401.h6G41tuN1252002@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:01:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] what is inline? (fwd)
Status: O
X-UID: 73
Content-Length: 304
X-Keywords: $NotJunk                                                                                           

>So is it correct to say that all inline does is replace the method call by the contents of the method?  Thanks.

Yes, replaces it appropriately.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-79-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:12:39 2003
Return-Path: <uhcosc1320-return-79-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4C85Z1268670
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:12:15 -0500 (CDT)
Received: (qmail 9763 invoked by uid 108); 16 Jul 2003 04:15:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3786 invoked from network); 16 Jul 2003 04:06:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160402.h6G42tSh1254249@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:02:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Monday Lecture (fwd)
Status: O
X-UID: 74
Content-Length: 3504
X-Keywords: $NotJunk                                                                                           

>So when you have.....
>
>>Void foo(const X& obj)
>>{
>>   ..
>>}
>> 
>>X obj1;
>>foo(obj1);
>
>you are giving a copy of obj1, and not obj1 itself, correct?

Well, what you are saying above is the opposite of what I have
mentioned below. Please read read what is given below.

Venkat

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 07/15/03 08:27 AM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] Monday Lecture (fwd)
>
>> 
>> >Hi Venkat,
>> 
>>Thank you very much for taking your time to read over the emails of the
>>students, your responses have really helped me to a better understanding
>>of the concepts you are teaching all of us.
>
>I am glad it is useful.
>
>>Going over my notes for today's lecture, I stumbled upon some minor
>>inquiries.
>> 
>>Can you please explain (again) the concept/purpose of "inline" in the
>>main.cpp of HW1? 
>> 
>
>I just sent out another email on this topic. Please refer to that and
>get back if you have more questions.
>
>>Also we learned today, that every time a constructor is called, a
>>destructor should also be called eventually.
>
>Correct it as "the" destructor instead of "a" destructor. There is
>only one destructor in a class.
>
>>Therefore for every constructor we build, we should immediately create a
>>destructor? If this is the case, then should we apply that in our HW1?
>
>While you can have any number of constructors, you are allowed to 
>have only one destructor in a class. 
> 
>>Can you please elaborate on the two types of methods: query and
>>modifiers? Is the only difference: one is found in public, the other in
>>private, or am I completely wrong?
> 
>A query method is one that does not modify the state of an object.
>Modifiers do. You generally make the query method a const method
>by placing "const" at the far right of the method signature.
>
>>An example you used today, to show demonstrate NOT TO PASS A METHOD BY
>>VALUE:
>> 
>>Void foo(const X& obj)
>>{
>>   ..
>>}
>> 
>>X obj1;
>>foo(obj1);
>> 
>>Why isn't the line that contains the call of foo written : foo(&obj1)?
>>Is void expecting a reference to a method?
>
>When calling a method, you will send the address of an object 
>(like &obj1) only if the function takes a pointer (like
>someFunction(X* p) ). foo in the above example is not taking a pointer.
>It is taking a reference. So, you are sending the object itself and
>not an address.
>
>Here is how I create a pointer to obj1.
>
>X* ptr = &obj1;
>
>Here is how I create a reference to obj1.
>
>X& ref = obj1;
>
>Now, ref is just an alias, or another name for obj1. Similarly, in foo,
>when foo(obj1) is called, obj is a reference or alias to obj1.
>
>>Finally, would you be able to go over debugging in class, there are some
>>nice tricks you use in class to elaborate on some concepts, and I think
>>as the class goes on, debugging the examples will be very helpful for
>>reviewing purposes.
>> 
>>Thanks again for your time!
>> 
>>Best regards,
>
>Absolutely. Let's do that today in class towards the end of the current
>session (chapter). Please remind me if I forget.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-78-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:12:41 2003
Return-Path: <uhcosc1320-return-78-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4B75Z1267040
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:12:40 -0500 (CDT)
Received: (qmail 9249 invoked by uid 108); 16 Jul 2003 04:14:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6044 invoked from network); 16 Jul 2003 04:09:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160406.h6G466pP1258860@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:06:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] class cancellation? (fwd)
Status: O
X-UID: 75
Content-Length: 390
X-Keywords: $NotJunk                                                                                           

>Hi,
>I was wondering if class would be cancelled today because of flooding.  

Sorry I did not get to this email until now. In the future, please
consult UH communications about these issues. That's whom I would
rely on.

Regards,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-80-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:18:32 2003
Return-Path: <uhcosc1320-return-80-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4IO5Z1275260
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:18:25 -0500 (CDT)
Received: (qmail 13136 invoked by uid 108); 16 Jul 2003 04:21:45 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10597 invoked from network); 16 Jul 2003 04:16:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160412.h6G4CucM1269885@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:12:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Midterm 1 on Monday (fwd)
Status: O
X-UID: 76
Content-Length: 573
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Will the Saturday review session be Q&A only? or will you be going over an
>outline of what will be covered in the midterm?

It is a open form. I will answer almost any question that is asked. 
You pretty much decide what you want to get out of that session.

>Also, will the midterm be multiple-choice, 

No.

>or will you ask us to write entirely just code? 

No, not entirely.

>Or will you ask us conceptual questions about the
>material covered?

That will be there too.

You may refer to some exams from the past semesters on the web.

>
>Thanks,

Venkat

From uhcosc1320-return-81-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:18:53 2003
Return-Path: <uhcosc1320-return-81-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4IS5Z1278552
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:18:38 -0500 (CDT)
Received: (qmail 13324 invoked by uid 108); 16 Jul 2003 04:21:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8944 invoked from network); 16 Jul 2003 04:13:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160410.h6G4A8Pp1264156@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:10:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] A question (fwd)
Status: O
X-UID: 77
Content-Length: 609
X-Keywords: $NotJunk                                                                                           

>There is an exmple that you showed us in the class
>yesterday, and I have a question for you.
>You said,
>
>String s1("hello there");
>String s2="haha";
>
>Is there any different between these two, except they
>have a different class and content?

The belong to the same class actually. The initial value
(content) is what's different.

>I mean, what if you did the following instedad String
>s1("hello there");?
>
>String s1="hello there";
>Thanks.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-82-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:28:37 2003
Return-Path: <uhcosc1320-return-82-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4Sa5Z1291651
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:28:36 -0500 (CDT)
Received: (qmail 18865 invoked by uid 108); 16 Jul 2003 04:32:02 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13739 invoked from network); 16 Jul 2003 04:22:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160418.h6G4Icvp1278908@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:18:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] regarding the inline (fwd)
Status: O
X-UID: 78
Content-Length: 538
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>
>       What if you use this line for the example in class
>
>                DBManager D1 = DBManager D2;

This will result in a compilation error as written.

>
>       will this break your inline code.

We did not have any issues with inlining in DBManager example.  
The bonus question was related to breaking the singleton, if that
is what you are referring to.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-83-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:32:41 2003
Return-Path: <uhcosc1320-return-83-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4Wf5Z1299720
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:32:41 -0500 (CDT)
Received: (qmail 21347 invoked by uid 108); 16 Jul 2003 04:36:07 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19219 invoked from network); 16 Jul 2003 04:32:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160428.h6G4SrHO1220036@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:28:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] COSC 1320 turnin (fwd)
Status: O
X-UID: 79
Content-Length: 901
X-Keywords: $NotJunk                                                                                           

>Mr. Venka, 

Who is that? 

>I am your Int. to Computer Science II 
>class(Summer 4). I just needed to find out how we are to turn in our 
>Homework and Assignments.
>
>Do we need to turn in a disk along with a hard copy?

No, only a hard copy for HW1.

>Do we turn our assignments directly to you, or the TAs?

You will never turn in any thing to the TA. It will be to me.

>Did you say that you were not going to be at UH on Wednesday?

No, I did not say that. 

>If so, do we turn in the HW to the TAs?
>Does it matter which TA we turn the programs to?
>
>
>Please reply.
>
>Thank you,

For the Assignment you will turnin an electronic copy. I will send you
the instructions as soon as I figure out when the bayou accounts will 
be ready.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-84-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:34:35 2003
Return-Path: <uhcosc1320-return-84-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4YZ5Z1304057
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:34:35 -0500 (CDT)
Received: (qmail 23271 invoked by uid 108); 16 Jul 2003 04:38:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15998 invoked from network); 16 Jul 2003 04:26:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160423.h6G4N7vS1286113@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:23:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] HW1 (fwd)
Status: O
X-UID: 80
Content-Length: 746
X-Keywords: $NotJunk                                                                                           

>Venkat, I used the code you supplied for the status member, but keep
>getting this error:  Thank you in advance for your help.
> 
>Compiling...
>Microwave.cpp
>K:\cosc1320\HW1\Microwave.cpp(52) : error C2664: 'sprintf' : cannot
>convert parameter 1 from 'const char *' to 'char *'
>        Conversion loses qualifiers
>Error executing cl.exe.
> 
>Microwave.obj - 1 error(s), 0 warning(s)
> 
>If I comment it out and just put a straight string the program will
>print it out.  Am I missing something?  The following are my .h and
>implementation files:
> 
... deleted...

Within your class, do not declare the private variable for the string
as const char*. Declare it only as char*. Only the return type of
status should be const char*.

Venkat

From uhcosc1320-return-85-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:37:01 2003
Return-Path: <uhcosc1320-return-85-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4b15Z1298526
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:37:01 -0500 (CDT)
Received: (qmail 24693 invoked by uid 108); 16 Jul 2003 04:40:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20357 invoked from network); 16 Jul 2003 04:34:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160431.h6G4V5NQ1298630@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:31:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Bonus Question 2 (fwd)
Status: O
X-UID: 81
Content-Length: 886
X-Keywords: $NotJunk                                                                                           

>Venkat,
>          You asked me to email this to you after I gave you the solution on
>paper after class.
> 
>I believe you had the following code in your Singleton example.
> 
>DBManager& m1 = DBManager::getInstance();
> 
>The question was, "How can we get a second instance of DBManager?"
> 
>We could use the following line to do that.
> 
>DBManager m3 = m1;
> 
>This would invoke the default copy constructor and give you a second object.

Good job. The second bonus point goes to you as well.

Here is bonus question 3. Can some one suggest how to eliminate
the above problem. In other words, can you fix the code I wrote
so this is not possible. The first person to respond with correct
answer get a bonus point as well.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-86-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:37:47 2003
Return-Path: <uhcosc1320-return-86-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4bk5Z1309091
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:37:47 -0500 (CDT)
Received: (qmail 25318 invoked by uid 108); 16 Jul 2003 04:41:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17649 invoked from network); 16 Jul 2003 04:30:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160413.h6G4DimI1271212@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:13:44 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Visual Studio 6.0 part of your book? (fwd)
Status: O
X-UID: 82
Content-Length: 385
X-Keywords: $NotJunk                                                                                           

>Venkat, the book we bought includes the Visual C++ 6.0 introductory edition,
>not the studio. Just wanted to clear that up before someone got upset when
>they found only the C++ app.

Thanks for clarifying this one.

Regards,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-87-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:41:01 2003
Return-Path: <uhcosc1320-return-87-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4f15Z1313699
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:41:01 -0500 (CDT)
Received: (qmail 27386 invoked by uid 108); 16 Jul 2003 04:44:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11677 invoked from network); 16 Jul 2003 04:19:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160410.h6G4AtD21266608@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:10:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] HI, it's just a ques about status func (fwd)
Status: O
X-UID: 83
Content-Length: 366
X-Keywords: $NotJunk                                                                                           

><P>why do you have to have msg at in the class as a private data member? Wouldn't the program still work if it was declared within the function. </P>

Are you taking care of properly cleaning up the memory?

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-88-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:41:05 2003
Return-Path: <uhcosc1320-return-88-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4f55Z1314205
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:41:05 -0500 (CDT)
Received: (qmail 27555 invoked by uid 108); 16 Jul 2003 04:44:31 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26261 invoked from network); 16 Jul 2003 04:42:22 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160438.h6G4coW41310679@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:38:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] one last questionabout HW1 (fwd)
Status: O
X-UID: 84
Content-Length: 1616
X-Keywords: $NotJunk                                                                                           

>Hey,
>   sorry for this last minute email, but i was just
>wondering about 2 things in the HW1 assigment.
>1) you said to declare status as_ const char*
>status()_
>   but i don't see a reason behind the const there
>since i'm not gioing to modify the return from
>status!!

Who is I? We are concerned about the user of the Microwave class.
It could be any one, isn't it. When we write a class, we need
to write it such that the user of our class is restricted to 
do only the right things.

>2) before using sprintf, i declared in .h, char
>string[100] to allocate space for the string. i know
>that i'm allocating on the stack not the heap.
>BUT how come it works for me well, doesn't it goes
>away when i return it or not?
>**** can you explain why would it matter using:
>string=new char[100] ---not-- char string[100]  ???
>
>THANKS SO MUCH FOR THE QUICK REPLIES OF YOURS, IT
>REALLY HELP ALOT !!!!! THANKS

You are almost correct in your discussion on defining
char msg[100]; 
instead of char* msg; and then creating msg = new char[100];

However, there is one reason why I am forced to use 
the second approach (with the new) than the first one.

I can only give you a clue. Take a look at your status
method and think through and make sure you have written it
very well. If written correctly, the status method will not
like you use the msg as defined in char msg[100]; I will have to 
defer until the homework is due to say more about this one. :)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-89-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:41:17 2003
Return-Path: <uhcosc1320-return-89-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4fG5Z1314593
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:41:17 -0500 (CDT)
Received: (qmail 27740 invoked by uid 108); 16 Jul 2003 04:44:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17238 invoked from network); 16 Jul 2003 04:29:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160414.h6G4EqxI1272901@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:14:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment1 (fwd)
Status: O
X-UID: 85
Content-Length: 406
X-Keywords: $NotJunk                                                                                           

>On the assignment guidelines, you ask us to create an abstraction.  Can you please explain to me what am abstraction is?  Thanks.

Abstract is nothing but modeling. You are modeling some thing when you 
are writing code for the HW or assignment.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-90-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:48:40 2003
Return-Path: <uhcosc1320-return-90-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4me5Z1305402
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:48:40 -0500 (CDT)
Received: (qmail 32385 invoked by uid 108); 16 Jul 2003 04:52:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29203 invoked from network); 16 Jul 2003 04:46:52 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160443.h6G4hKH81317954@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:43:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Answer for question 3! (fwd)
Status: O
X-UID: 86
Content-Length: 484
X-Keywords: $NotJunk                                                                                           

>We can avoid that problem by writting an empty copy constructor and make it private!!!! Hope this is right!!!!!

Well I will buy that. The correct answer is, we will not implement the
copy constructor. We will simply declare it as private.

private:
	DBManager(const DBManager& other);

You got the bonus point for this one.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-91-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:52:16 2003
Return-Path: <uhcosc1320-return-91-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4qF5Z1332155
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:52:16 -0500 (CDT)
Received: (qmail 2187 invoked by uid 108); 16 Jul 2003 04:55:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30541 invoked from network); 16 Jul 2003 04:49:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160445.h6G4jehd1321779@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:45:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] System Time (fwd)
Status: O
X-UID: 87
Content-Length: 704
X-Keywords: $NotJunk                                                                                           

>I was wondering 3 questions:
>
>1) What's the function call to get system time?

Please refer to the example I posted early this morning.

>
>2) What is the format the system time is in?

Again the same example will tell you that as well.

>3) Am I on the right track that I can use the system time for the logic of 
>this program?
>
>Thank you for your time!

The example I had posted pretty much does it. You will have to simply 
copy and paste it and modify it to suite your needs.

Most of the solution has been given in the emails already!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-92-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 15 23:52:58 2003
Return-Path: <uhcosc1320-return-92-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G4qv5Z1333027
	for <cosc155g@bayou.uh.edu>; Tue, 15 Jul 2003 23:52:57 -0500 (CDT)
Received: (qmail 2846 invoked by uid 108); 16 Jul 2003 04:56:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31624 invoked from network); 16 Jul 2003 04:50:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160447.h6G4lPC01324513@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:47:25 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] If you can move the due date for Assign#1 (fwd)
Status: O
X-UID: 88
Content-Length: 518
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>I just wonder if we could have a little bit more time
>for Assign#1, since the hw#1 took us quite much of the
>time.
>
>Thanks

This is just the beginning. It is not going to get any easier by
postponing since you have three more HWs and three more assignments.
So, let's not postpone the problem. Let's work towards the solution
and get it done.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-95-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 12:28:14 2003
Return-Path: <uhcosc1320-return-95-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6GHSD5Z1138052
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 12:28:13 -0500 (CDT)
Received: (qmail 6530 invoked by uid 108); 16 Jul 2003 17:31:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8528 invoked from network); 16 Jul 2003 15:27:40 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307161521.h6GFL5Ra621449@creek.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 10:21:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] A question about status method (fwd)
Status: O
X-UID: 89
Content-Length: 992
X-Keywords: $NotJunk                                                                                           

>Sorry to bother you again. I thought every time the function status was
>called, the message was dertermined again based on whether the microwave was
>still running or not. Thus the static array was although "shared" for all
>objects but the message in array was just for one object. It was changed
>every time an object wanted to get the status. I am still confused about
>this because I got the same answer in both cases (static array and private
>array)
>
>Thanks.

Agreed, But (a big if needs to be considered). If you ever create 
two objects of your Microwave in two different threads, and call the
status of each one from the two different threads, the two threads will
end up overwriting the static variable and the result is unpredictable.
If you want a example to see this happening, let me know and I will
email you one.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-93-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 00:24:12 2003
Return-Path: <uhcosc1320-return-93-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G5OC5Z1382277
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 00:24:12 -0500 (CDT)
Received: (qmail 22370 invoked by uid 108); 16 Jul 2003 05:27:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12011 invoked from network); 16 Jul 2003 04:19:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160416.h6G4GANC1273548@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:16:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] homework1 : Destructor (fwd)
Status: O
X-UID: 90
Content-Length: 462
X-Keywords: $NotJunk                                                                                           

>Are we supposed to include a destructor in our HW 1?

I will let you decide that one.

>If so, where/when are we supposed to delete the object? I understand that in
>this particular exercise, memory leak may not be an issue at all...
>
>Thanks,

Are you sure? ;) Take a close look at the status method.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-94-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 00:39:12 2003
Return-Path: <uhcosc1320-return-94-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6G5dC5Z1405291
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 00:39:12 -0500 (CDT)
Received: (qmail 31828 invoked by uid 108); 16 Jul 2003 05:42:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14836 invoked from network); 16 Jul 2003 04:24:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307160420.h6G4Ki8B1282387@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 15 Jul 2003 23:20:44 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] what is the difference between "C style static" and "C++ static"? (fwd)
Status: O
X-UID: 91
Content-Length: 673
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Can you give a general answer as to the basic differences on the two
>meanings of static in C and C++? Thanks for your time.

In C, local variables within functions may be declared static.
These static variables are initialized the first time you enter
the method. 

In C++ (in addition to the above, of course), member variables 
of a class may be declared static. These do not belong to any
object. They exist even when no objects of the class exists.
These are initialize when the program starts up.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-96-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 12:28:52 2003
Return-Path: <uhcosc1320-return-96-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6GHSq5Z1143154
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 12:28:52 -0500 (CDT)
Received: (qmail 7288 invoked by uid 108); 16 Jul 2003 17:32:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6210 invoked from network); 16 Jul 2003 17:31:24 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307161727.h6GHRnpB1140650@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 12:27:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question regarding assignment1 (fwd)
Status: O
X-UID: 92
Content-Length: 501
X-Keywords: $NotJunk                                                                                           

>Dr Venkat;
>
>Sorry if you answered this already, but I am confused.
>
>Is the getCounterLimit method supposed to return a value of the limit?
>If so why does main have an argument on the method.
>
>counter.getCounterLimit(limit);
>
>Thank You,


The getCounterLimit will fill the given variable with the value of the
limit the counter has.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-97-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 12:34:01 2003
Return-Path: <uhcosc1320-return-97-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6GHY05Z1156012
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 12:34:01 -0500 (CDT)
Received: (qmail 12522 invoked by uid 108); 16 Jul 2003 17:37:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8631 invoked from network); 16 Jul 2003 17:33:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307161730.h6GHU6r31145267@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 12:30:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] static int (fwd)
Status: O
X-UID: 93
Content-Length: 753
X-Keywords: $NotJunk                                                                                           

>Can you tell me why in your Person.h file you have
>     static int numberOfPersons;
>                   ......
>     static int getNumberOfPersons();
>
>but in your Person.cpp file you have 
>     int Person::numberOfPersons = 0;
>                   ......
>     int Person::getNumberOfPersons()
>
>
>Shouldn't there be static before int in your Person.cpp file?
>
>Thanks.

The "static" in .h defines the member variable and the method
as static.  In the .cpp file, you are initializing the 
variable and implementing the method and there is no need to
tell it again that these are static. 


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-98-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 12:35:54 2003
Return-Path: <uhcosc1320-return-98-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6GHZs5Z1159529
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 12:35:54 -0500 (CDT)
Received: (qmail 14445 invoked by uid 108); 16 Jul 2003 17:39:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11573 invoked from network); 16 Jul 2003 17:36:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307161732.h6GHWwvv1152994@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 12:32:58 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign1: getNumberofModuloCounters function (fwd)
Status: O
X-UID: 94
Content-Length: 808
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>Could you please explain to me how the "getNumberofModuloCounters" =
>function works?  My compiler will not let me use the function directly =
>with the instruction "ModuloCounter::getNumberofModuloCounters()."  =
>However, I understand how the other functions (ex. =
>"theCounter.getCounterValue() ) work, and they work fine.  I feel like I =
>am missing the big picture here...
>
>Thank you very much for your time!
>
>Sincerely,

Please refer to examples we wrote in class on the 15th July.
This should give you ideas and help you answer your own question.
If after reviewing those, you still can't figure out, send me an email.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-99-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 12:42:45 2003
Return-Path: <uhcosc1320-return-99-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6GHgi5Z1177875
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 12:42:44 -0500 (CDT)
Received: (qmail 21455 invoked by uid 108); 16 Jul 2003 17:46:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19393 invoked from network); 16 Jul 2003 17:44:06 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307161740.h6GHeVno1172612@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 12:40:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] time_t example (fwd)
Status: O
X-UID: 95
Content-Length: 813
X-Keywords: $NotJunk                                                                                           

><P>&nbsp;Venkat, </P></DIV>
><DIV></DIV>
><P>&nbsp;</P>
><P>can you put the time_t code example up in the class examples? I thought I had it , but </P>
><P>I don't</P>

We did not write this one  in the class. I wrote in and emailed it.
Please take a look at the previous emails to find this example.

The previous examples can be found at 

~cosc155g/COSC1320/mailstoclass 

on machine bayou or by visiting

http://www.cs.uh.edu/~svenkat/summer2002/mailstoclass.
(this URL I have not had a chance to test. I am at a client site
and I can browser to UH from here and so I guess it should work,
but have no way of knowing until I get to my office or UH).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-100-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 12:47:07 2003
Return-Path: <uhcosc1320-return-100-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6GHl75Z1189060
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 12:47:07 -0500 (CDT)
Received: (qmail 25653 invoked by uid 108); 16 Jul 2003 17:50:31 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23455 invoked from network); 16 Jul 2003 17:48:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307161744.h6GHiW411179592@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 12:44:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Singleton, Is it a good idea? (fwd)
Status: O
X-UID: 96
Content-Length: 1610
X-Keywords: $NotJunk                                                                                           

>Hello venkat,
>
>Lets take your DBManager class.  If I add a private
>data member variable "int yearsOfExperience" and
>initialize it to 10 in a constructor.  I will also add
>one modifier method "setYearsOfExperience(int
>experience)" that will change the value of
>"yearsOfExperience".  Finally, one more query method
>"int getYearsOfExperience()" which will return
>"yearsOfExperience". 
>
>In main, suppose I created a reference by
>DBManager& m1 = DBManager::getInstance();
>and invoke m1.setYearsOfExperience(1000);
>
>Now suppose I created another reference by
>DBManager& m2 = DBManager::getInstance();
>
>and query the object by 
>m2.getYearsOfExperience();
>
>m2 will return a value of 1000.
>
>I think that this can cause a problem to the user of
>the class.  And thus feel that this practice
>(singleton objects) is a bad idea just like using
>friends is a bad idea.
>
>Can you please give me a senario on why a developer
>would want no more than one object be created for his
>class?
>
>Thank you


First, DBManager as specified in that example is not a human!
It stands for a database driver which will help you connect
with the database etc. Having more than one is not necessary
because one instance of DBManager may be used to manage 
several database connections. 

You would use singleton is you want to enforce that only
one instance of the class should be allowed. If you do not
want to enforce that, you would not use singleton.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-101-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 12:47:30 2003
Return-Path: <uhcosc1320-return-101-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6GHlU5Z1190018
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 12:47:30 -0500 (CDT)
Received: (qmail 26063 invoked by uid 108); 16 Jul 2003 17:50:54 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20808 invoked from network); 16 Jul 2003 17:45:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307161741.h6GHftJT1176182@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 12:41:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Sample tests. (fwd)
Status: O
X-UID: 97
Content-Length: 541
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Were are the sample tests located?  Are you referring to the ones on the uh courses website?  I have been to the examples site and your homepage site and can not locate them.  If I am overlooking them I apologize.  However, could you send me a link to were they are?
>

Please visit

http://www.cs.uh.edu/~svenkat/classes 

and click on the link to Exams from the past.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-102-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 12:50:45 2003
Return-Path: <uhcosc1320-return-102-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6GHoh5Z1198426
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 12:50:43 -0500 (CDT)
Received: (qmail 29408 invoked by uid 108); 16 Jul 2003 17:54:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26705 invoked from network); 16 Jul 2003 17:51:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307161747.h6GHlo501191286@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 12:47:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] COSC 1320 turnin (fwd)
Status: O
X-UID: 98
Content-Length: 574
X-Keywords: $NotJunk                                                                                           

>Mr. Venka, I just needed to find out how we are to turn in our Homework and 
>Assignments.
>Do we need to turn in a disk along with a hard copy?
>Do we turn our assignments directly to you, or the TAs?
>Did you say that you were not going to be at UH on Wednesday?
>If so, do we turn in the HW to the TAs?
>Does it matter which TA we turn the programs to?
>
>Thanks

Please refer to previous emails on this topic. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-103-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 12:50:57 2003
Return-Path: <uhcosc1320-return-103-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6GHou5Z1197973
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 12:50:57 -0500 (CDT)
Received: (qmail 29589 invoked by uid 108); 16 Jul 2003 17:54:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25316 invoked from network); 16 Jul 2003 17:50:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307161746.h6GHkYsU1187629@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 12:46:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] getCounterValue (fwd)
Status: O
X-UID: 99
Content-Length: 868
X-Keywords: $NotJunk                                                                                           

>The following is the code for my getCounterValue....
>int ModuloCounter::getCounterValue(){
>	return counter;
>}
>
>
>How come when you call 
>	cout << "Counter Value is " << 
>			theCounter.getCounterValue() << endl;
>}
> I keep getting an error message stating
>error C2662: 'getCounterValue' : cannot convert 'this' pointer from 'const class ModuloCounter' to 'class ModuloCounter &'
>
>Am I setting up some sort of pointer.  I thought all this function would do is go look at the variable counter, and return its value.  Can you advise as to what I may be doing wrong.  Thanks.
>

Here is a hint. You are not following one of the rules that we discussed in
things to watch out when programming with C++.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-104-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:24:04 2003
Return-Path: <uhcosc1320-return-104-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4O35Z1280228
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:24:03 -0500 (CDT)
Received: (qmail 28229 invoked by uid 108); 17 Jul 2003 04:27:34 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26989 invoked from network); 17 Jul 2003 04:25:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170422.h6H4M9Ih1271898@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:22:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] DBManager (fwd)
Status: O
X-UID: 100
Content-Length: 524
X-Keywords: $NotJunk                                                                                           

>hi Venkat,
>
>I want to clarify some doubts about singleton,
>Dbmanger.
>
>1)In the DBmanager.h, you defined method called
>getinstance, that returns refernce to a DBmanger rt?

Yep, note that it is a static method.

>
>2)why u made the constructor private?? 
>tahnks

Yep. I mentioned in class that one may want to make the constructor
a protected method instead.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-105-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:24:41 2003
Return-Path: <uhcosc1320-return-105-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4Of5Z1282621
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:24:41 -0500 (CDT)
Received: (qmail 28832 invoked by uid 108); 17 Jul 2003 04:28:07 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25693 invoked from network); 17 Jul 2003 04:23:47 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170420.h6H4KAwb1271002@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:20:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] using namespace (fwd)
Status: O
X-UID: 101
Content-Length: 316
X-Keywords: $NotJunk                                                                                           

>can you explain one more time about "using namespace std;" please

We will be discussing namespaces in detail in class. That topics just
around the corner. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-106-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:25:23 2003
Return-Path: <uhcosc1320-return-106-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4PM5Z1282800
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:25:22 -0500 (CDT)
Received: (qmail 29389 invoked by uid 108); 17 Jul 2003 04:28:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24841 invoked from network); 17 Jul 2003 04:22:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170418.h6H4Iots1266022@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:18:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Question regarding assignment1 (fwd)
Status: O
X-UID: 102
Content-Length: 1057
X-Keywords: $NotJunk                                                                                           

>So for our getCounterLimit function, do we need to set up our function to have a single parameter which is then changed to equal the value of the Mod limit for the counter and return this new value?  Is this the function or role of getCounterLimit?  Thank you.
>

Yes.

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 07/16/03 12:27 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] Question regarding assignment1 (fwd)
>
>> 
>> >Dr Venkat;
>>
>>Sorry if you answered this already, but I am confused.
>>
>>Is the getCounterLimit method supposed to return a value of the limit?
>>If so why does main have an argument on the method.
>>
>>counter.getCounterLimit(limit);
>>
>>Thank You,
>
>
>The getCounterLimit will fill the given variable with the value of the
>limit the counter has.
>
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475

From uhcosc1320-return-107-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:29:33 2003
Return-Path: <uhcosc1320-return-107-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4TX5Z1292582
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:29:33 -0500 (CDT)
Received: (qmail 302 invoked by uid 108); 17 Jul 2003 04:33:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24100 invoked from network); 17 Jul 2003 04:21:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170417.h6H4HtLo1264722@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:17:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Inquiry about Class schedule (fwd)
Status: O
X-UID: 103
Content-Length: 340
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I just need to confirm whether we have class on Fridays now from 6 - 8 pm? I 
>need ...deleted...

We will not have a class on Friday. We meet only Monday thru Thursday.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-108-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:34:36 2003
Return-Path: <uhcosc1320-return-108-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4YZ5Z1308969
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:34:35 -0500 (CDT)
Received: (qmail 4288 invoked by uid 108); 17 Jul 2003 04:38:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2443 invoked from network); 17 Jul 2003 04:35:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170431.h6H4VnB21301623@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:31:49 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assigm1 question??? (fwd)
Status: O
X-UID: 104
Content-Length: 650
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> i was wondering if you can help me with the
>getcountervalue, i don't know how to declare it.
>i declare it as int, but then i get an error as:
> {{getCounterValue' : cannot convert 'this' pointer
>from 'const class ModuloCounter' to 'class
>ModuloCounter &' }}
>
>thanks for your help

Make sure you are following all the things to watch out in C++
are followed.  We have written a few of these "things" in class.
It can be found in the ExamplesFromClass directory as well.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-109-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:38:25 2003
Return-Path: <uhcosc1320-return-109-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4cP5Z1319082
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:38:25 -0500 (CDT)
Received: (qmail 7447 invoked by uid 108); 17 Jul 2003 04:41:46 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27735 invoked from network); 17 Jul 2003 04:26:48 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170423.h6H4NBYY1278954@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:23:11 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] DBMangaer again (fwd)
Status: O
X-UID: 105
Content-Length: 530
X-Keywords: $NotJunk                                                                                           

>please take a look at the code below
>here m1 and m2 points the same dbManger  rt???. is
>that why you said there is only one DBmanager
>created??
>
>DBManager& m1 = DBManager::getInstance();
>
>	DBManager& m2 = DBManager::getInstance();

getInstance returns reference to one and only one instance.
Does not matter how many times you call it, you get the 
same instance.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-110-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:39:22 2003
Return-Path: <uhcosc1320-return-110-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4dL5Z1321254
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:39:21 -0500 (CDT)
Received: (qmail 8398 invoked by uid 108); 17 Jul 2003 04:42:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5861 invoked from network); 17 Jul 2003 04:39:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170436.h6H4a51w1313250@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:36:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Re: Assignment submission (fwd)
Status: O
X-UID: 106
Content-Length: 567
X-Keywords: $NotJunk                                                                                           

>Hello,
>
>Have you given info on submitting our assignments and on activating our
>bayou accounts?
>I had to miss class of Wed, my apoligies if you went over this then.
>
>Thank you,

No. I am still waiting for bayou accounts to be created!!!!!!!

I will let you know as soon as I hear. I have left a few reminders to
the concerned person, but things do not move at the desired speed
in some places I guess.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-111-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:39:57 2003
Return-Path: <uhcosc1320-return-111-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4du5Z1320287
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:39:56 -0500 (CDT)
Received: (qmail 9123 invoked by uid 108); 17 Jul 2003 04:43:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7223 invoked from network); 17 Jul 2003 04:41:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170437.h6H4bjZ51317707@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:37:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] passing by value (fwd)
Status: O
X-UID: 107
Content-Length: 892
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>My program works fine until it comes to the function that passes by value.  
>I was informed that when it enters that function another counter is supposed 
>to be created, a copy.  

Yes. So think about it and think about issues related to this that
we spoke in length in class.

>Well my problem is that it is not happening to me.  

It is happening. Pay more attention to what is going on.

>But one thing that is happening to me is that at the end of that function 
>the destructor is called and it deletes the one counter i have so the last 
>three calls for numberofCounters are equal to zero.
>
>Thanks in advance.

Focus on what will happen when a copy of an object is made using another
instance of the same type.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-112-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:50:06 2003
Return-Path: <uhcosc1320-return-112-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4o65Z1349048
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:50:06 -0500 (CDT)
Received: (qmail 16990 invoked by uid 108); 17 Jul 2003 04:53:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4633 invoked from network); 17 Jul 2003 04:38:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170434.h6H4YgCr1309593@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:34:42 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] hw1 and the status() const method (fwd)
Status: RO
X-UID: 108
Content-Length: 1625
X-Keywords: $NotJunk                                                                                           

><html><div style='background-color:'><DIV>Venkat,<BR>&nbsp; <BR>&nbsp; I have overheard you at the end of class saying that the status() method was supposed to be query method.&nbsp; I was comtemplating the issue for quite a while before i turned in the homework and decided not to make it a query method.&nbsp; i did realize however, that it should've been, but i could not figure out a way to pass the pointer to a string without creating a member or global variable.&nbsp; i didnt create an automatic, because the life of the variable ends when the method has returned.&nbsp; Also, i did not want to create a pointer to a string using new because if i were to pass the pointer in this fashion, i would definitely end up with memory leak.&nbsp; After still thinking about this, i realized the easy answer to this problem. static variable.&nbsp; i declared a static char str[50] variable within the status() method thus creating a static pointer constant.&nbsp; because of it being stati!
 c, it was able to pass it's address to the calling program and then allow for the method to then be a query method.&nbsp; and i'm thinking there will be no memory leak since it is created on the stack and thus will die when the program has ended.&nbsp; would this be a good way to solve this problem?</DIV>

In an email this morning I mentioned why using a static variable for this
purpose is not a good idea. Please refer to that email.

... rest of the email ...deleted...

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-113-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 16 23:50:39 2003
Return-Path: <uhcosc1320-return-113-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6H4od5Z1350908
	for <cosc155g@bayou.uh.edu>; Wed, 16 Jul 2003 23:50:39 -0500 (CDT)
Received: (qmail 17547 invoked by uid 108); 17 Jul 2003 04:54:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16400 invoked from network); 17 Jul 2003 04:53:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307170449.h6H4nbRA1348897@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 16 Jul 2003 23:49:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] passing by value (fwd)
Status: O
X-UID: 109
Content-Length: 409
X-Keywords: $NotJunk                                                                                           

>venkat,
>
>I have the exact same problem. I figured out, from the debugger, that my
... rest of the email deleted...
>Is that right?
>
>What can I do?
>
>Thanks,

The format of a copy constructor for a class X is

X(const X& other)

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-114-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 07:22:54 2003
Return-Path: <uhcosc1320-return-114-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6HCMs5Z1454839
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 07:22:54 -0500 (CDT)
Received: (qmail 2128 invoked by uid 108); 17 Jul 2003 12:26:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30658 invoked from network); 17 Jul 2003 12:20:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307171217.h6HCHK4S1440734@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 07:17:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assign 1 Q. (fwd)
Status: O
X-UID: 110
Content-Length: 1036
X-Keywords: $NotJunk                                                                                           

>I am having trouble with my program when printCounterInfo tries to call my getCounterValue.  Could you please explain the argument of printCounterInfo (const ModuloCounter& theCounter)   what exactly is being referenced with a const?  I'm still confused with referencing.

Let me explain with another example.
Let X be a class.

class X
{
public:
	X() { val = 0; }
	void setVal(int v)
	{
		val = v;
	}
	int getVal() const
	{
		return val;
	}
private:
	int val;
};

If I have 

void printVal(const X& ref)
{
	// ref is a reference to what ever is passed to printVal 
	// from main or any other function. This ref is marked as
	// a const. It is a read-only reference. Using it
	// you can call query methods, but you can not call modifiers.
	// In other words, using ref, you can call getVal, in this
	// example. However, you are not allwed to call setVal.
}

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-115-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 07:26:08 2003
Return-Path: <uhcosc1320-return-115-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6HCQ75Z1463635
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 07:26:08 -0500 (CDT)
Received: (qmail 4589 invoked by uid 108); 17 Jul 2003 12:29:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2054 invoked from network); 17 Jul 2003 12:26:11 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307171222.h6HCMXN31447159@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 07:22:32 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] linker error in assign 1 (fwd)
Status: O
X-UID: 111
Content-Length: 709
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>I am having a problem with a linker error I keep getting.  I am using =
>Dev C++ and I get this message 3 times when I compile:
>
>[Linker error] undefined reference to =
>'ModuloCounter::numberOfModuloCounters'
>
>Do you have an idea of what could be going wrong?  I decared =
>numberOfModuloCounters to be a static int.  Thank you so much.

Yes, take a look at the Person example I wrote in class on Monday
(July 14th). Study it carefully, compile and play with it. If that works,
your code should also work if you write similarly.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-116-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 07:32:34 2003
Return-Path: <uhcosc1320-return-116-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6HCWY5Z1481239
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 07:32:34 -0500 (CDT)
Received: (qmail 9699 invoked by uid 108); 17 Jul 2003 12:36:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3350 invoked from network); 17 Jul 2003 12:27:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307171219.h6HCJEcK1442339@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 07:19:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] passing by value (fwd)
Status: O
X-UID: 112
Content-Length: 666
X-Keywords: $NotJunk                                                                                           

>venkat,
>
>How come just right before the copy-constructor is called, "other" has
>already the objects copied into!? And then, the original objects are
>corrupted?!

In the copy constructor  X(const X& other), other does not have the
contents copied into. It is the other object itself. It is passed
by reference.

So in 

X obj1 = obj2;

The copy constructor is invoked for obj1. Within the copy constructor,
at that instance, other is a reference (is just another name, it 
is itself not a copy) of obj2.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-117-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 07:33:50 2003
Return-Path: <uhcosc1320-return-117-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6HCXo5Z1484372
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 07:33:50 -0500 (CDT)
Received: (qmail 10738 invoked by uid 108); 17 Jul 2003 12:37:17 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3782 invoked from network); 17 Jul 2003 12:28:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307171224.h6HCOr8e1460560@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 07:24:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] declaring static int variable in assign1.cpp (fwd)
Status: O
X-UID: 113
Content-Length: 574
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>...deleted...

The above deleted question has been answered in another email, please
refer to that.

>P.S. I compiled my program in bayou, but I forgot how to actually run =
>the final executable file.  Could you please tell me the command? 

If your compile program is named prog, you can run it by typing

./prog

If you current directory "." is set in the path, you can simply type
prog
as well.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-118-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 07:37:20 2003
Return-Path: <uhcosc1320-return-118-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6HCbJ5Z1493744
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 07:37:20 -0500 (CDT)
Received: (qmail 13612 invoked by uid 108); 17 Jul 2003 12:40:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3944 invoked from network); 17 Jul 2003 12:28:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307171221.h6HCL4231446692@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 07:21:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Re: Assignment submission (fwd)
Status: O
X-UID: 114
Content-Length: 501
X-Keywords: $NotJunk                                                                                           

>Hello again,
>
>If the bayou accounts are not ready by the due date for assignment one, will
>this affect the due date or will we be expected to turn it in by other
>means?
>
>Thanks again

If you basic question is to see if you will get more time to do this,
I would not risk that. If I were you, I will get it done for the
given dead line.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-119-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 07:42:51 2003
Return-Path: <uhcosc1320-return-119-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6HCgp5Z1507895
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 07:42:51 -0500 (CDT)
Received: (qmail 17914 invoked by uid 108); 17 Jul 2003 12:46:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8402 invoked from network); 17 Jul 2003 12:34:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307171230.h6HCUqbd1476660@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 07:30:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignm1 (fwd)
Status: O
X-UID: 115
Content-Length: 582
X-Keywords: $NotJunk                                                                                           

..deleted...

I summerize the question as how do I write a copy constructor.

Here is an example.

class X
{
	X(int val);
	X(const X& other);
private:
	int v;
};

In X.cpp we have

X::X(int val)
{
	v = val;
}

X::X(const X& other)
{
	v = other.v;
}

Of course, in this particular example, even if we did not write the 
copy constructor, the automatically privided copy constructor will
be doing just that.

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-120-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 22:13:45 2003
Return-Path: <uhcosc1320-return-120-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I3Dj5Z1168020
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 22:13:45 -0500 (CDT)
Received: (qmail 23128 invoked by uid 108); 18 Jul 2003 03:17:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19964 invoked from network); 18 Jul 2003 03:12:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180257.h6I2v3ns1122147@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 21:57:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Instructions to submit assignment 1
Status: O
X-UID: 116
Content-Length: 1038
X-Keywords:                                                                                                    



Please read this carefully.


1. Make sure your name appears in the .h and .cpp file.
2. Put the ModuloCounter.h and .cpp file in a directory named
	assign1.
3. I am assuming you have installed winzip on your system.
	If you want to use some other zip program, that is fine as well.
4. If you are using winzip, right click on the assign1 directory
	and select zip to assign1.zip.
5. Visit the course web site at http://www.cs.uh.edu/~svenkat/summer2003.
6. Follow the link that says submit assignment.
7. Enter your email address and click on Forgot Password? link to find 
	your password.
8. After checking your email, enter the ID (password) and click submit.
9. Click the browse button that shows up, and select the assign1.zip file.
10. Click send to submit.

Make sure it says the submit was successful.

You can submit your assignment as many times as you like until
the deadline. The latest submission is the one that will be kept.

This has been tested with IE browser.

Please let me know if you have any difficulties.

Venkat

From uhcosc1320-return-121-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 23:29:35 2003
Return-Path: <uhcosc1320-return-121-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I4TZ5Z1368339
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 23:29:35 -0500 (CDT)
Received: (qmail 13265 invoked by uid 108); 18 Jul 2003 04:33:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10676 invoked from network); 18 Jul 2003 04:29:22 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180425.h6I4PbM81357985@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:25:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Const confusion (fwd)
Status: O
X-UID: 117
Content-Length: 1268
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Could you please let me know what questions to ask myself when planning to develop code with "const" in it?  I am having trouble understanding what the const's do in a given position.  I find myself asking does this method need a const at the far right or far left or before the variable est..  I need help understanding what questions to ask myself to determine what const's are needed and where they go.  I hope this question is clear to you.  I apologize for asking a question that has been beat to death; I just don't quite have it yet.

Consider a function. const may appear on the far left, in front of
an argument, and finally at far right. Here are the questions to ask.

1. Do I want to make sure that the caller of my method does not
	modify the returned result.
		Place a const at far left.
2. Do I want to promise that my method does not modify the argument
	sent to my method.
		Place a const in front of the argument.
3. Do I want to say that my method is a query method, i.e., it does not
	modify the object on which it is called.
		Place a const at the far right.

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-122-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 23:36:07 2003
Return-Path: <uhcosc1320-return-122-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I4a65Z1385606
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 23:36:06 -0500 (CDT)
Received: (qmail 18267 invoked by uid 108); 18 Jul 2003 04:39:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15482 invoked from network); 18 Jul 2003 04:36:17 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180432.h6I4WYH41375548@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:32:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment1: negative Counter ModLimit value (fwd)
Status: O
X-UID: 118
Content-Length: 338
X-Keywords: $NotJunk                                                                                           

>Hello
> 
>In assignment 1,do we need to take care of the possiblility that a negative counter 'mod limit' value may be entered??
>Thanks

You do not have to worry about this one.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-123-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 23:38:34 2003
Return-Path: <uhcosc1320-return-123-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I4cW5Z1392269
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 23:38:32 -0500 (CDT)
Received: (qmail 20049 invoked by uid 108); 18 Jul 2003 04:42:09 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17753 invoked from network); 18 Jul 2003 04:38:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180435.h6I4ZDVT1383662@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:35:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Copy Constructor in Assignment1 and bayou account (fwd)
Status: O
X-UID: 119
Content-Length: 555
X-Keywords: $NotJunk                                                                                           

><P>Hi Venkat</P>
><P>I have two questions to ask you:</P>
><P>1. First is about the ...deleted...

I will let you think about the question. While I try to give 
answers, I do not want to solve the assignment for you. So, at some
point, I will let you figure things out. You have reached so
close to the solution that I want to do just that.

><P>Thank you for taking time to read the email. </P>

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-124-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 23:46:19 2003
Return-Path: <uhcosc1320-return-124-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I4kJ5Z1411187
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 23:46:19 -0500 (CDT)
Received: (qmail 25645 invoked by uid 108); 18 Jul 2003 04:49:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24855 invoked from network); 18 Jul 2003 04:48:49 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180445.h6I4j6Cn1409144@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:45:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] grading on homework (fwd)
Status: O
X-UID: 120
Content-Length: 920
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>I heard you mention today in class that we shouldn't include our 
>implementation of our class methods in the .h file.  I realized that I had done just that 
>in the homework without knowing that you wished it the other way.  The program 
>still runs and outputs as desired except for the fact that the implementation 
>is in the header file.  Will you be deducting points for this?  If so, would 
>it be okay to return the homework in with a .cpp file with the implementation? 
> Thanks in advance.

Hi

While I spend significant amount of time replying to technical questions
over email, I do not encourage points, grades or score related questions.
If you have questions related to grades or points, please talk to me
during my office hours.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-125-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 17 23:49:39 2003
Return-Path: <uhcosc1320-return-125-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I4nd5Z1421386
	for <cosc155g@bayou.uh.edu>; Thu, 17 Jul 2003 23:49:39 -0500 (CDT)
Received: (qmail 27759 invoked by uid 108); 18 Jul 2003 04:53:16 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23936 invoked from network); 18 Jul 2003 04:47:39 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180443.h6I4hvsj1406618@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:43:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 1 (fwd)
Status: O
X-UID: 121
Content-Length: 413
X-Keywords: $NotJunk                                                                                           

>Mr Vekat
>
>       I submitted the home work today and can you just let me know if the 
>submission is a success and that you were able to open the file.
>
>thanx

If a message was displayed on the web page that said Success, 
that is your confirmation.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-126-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 00:14:06 2003
Return-Path: <uhcosc1320-return-126-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I5E55Z1483509
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 00:14:05 -0500 (CDT)
Received: (qmail 11951 invoked by uid 108); 18 Jul 2003 05:17:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8505 invoked from network); 18 Jul 2003 05:12:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180439.h6I4drWh1395984@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:39:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] overloading (fwd)
Status: O
X-UID: 122
Content-Length: 907
X-Keywords: $NotJunk                                                                                           

>Can you explain to me why c3=c1+2.1 does not equal to c3=2.1+c1 when writing the function.  Also, can you explain what is meant by promotion and what is meant by member promotion. Still unclear. Thanks.

Unlike primitive types, when it comes to overloading, the compiler looks
for methods to execute. Since these are user defined methods, it looks for
different methods for c1 + 2.1 and 2.1 + c1. These are seen as two 
different invocations by the compiler.

When we talk about promotions, we are talking about how type conversion 
happens.

For example if we have

int a = 5;
double d = a;

Here, a is converted into a double. We call this promotion. Typically,
we see this in method calls. 

I am not aware of any thing called member promotion.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-127-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 00:19:02 2003
Return-Path: <uhcosc1320-return-127-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I5J25Z1494634
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 00:19:02 -0500 (CDT)
Received: (qmail 15798 invoked by uid 108); 18 Jul 2003 05:22:34 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11201 invoked from network); 18 Jul 2003 05:16:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180432.h6I4W9Gn1375280@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:32:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] virtual destructor (fwd)
Status: O
X-UID: 123
Content-Length: 434
X-Keywords: $NotJunk                                                                                           

>Could you please explain the need for the virtual destructor in the 
>aggregate by value example you did in class.  I am a little confused.

We have not discussed virtual destructors in class. It is a concept
important to understand.  We will get to it later in the course.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-128-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 00:19:32 2003
Return-Path: <uhcosc1320-return-128-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I5JW5Z1498604
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 00:19:32 -0500 (CDT)
Received: (qmail 16388 invoked by uid 108); 18 Jul 2003 05:23:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10989 invoked from network); 18 Jul 2003 05:16:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180430.h6I4UMVE1369529@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:30:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] debuggin errors (fwd)
Status: O
X-UID: 124
Content-Length: 525
X-Keywords: $NotJunk                                                                                           

>While I try to debug my program, I place some breakpoints.  While the debug, a window pops up titled "Find Source" and it askes me to enter the path for OSTREAM.CPP.  If its refering to me placing #include<iostream>, I already have it on my ModuloCounter.cpp and main.cpp.  Any ideas as to what I may be missing?

In these cases, step over instead of stepping into.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-129-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 00:23:21 2003
Return-Path: <uhcosc1320-return-129-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I5NK5Z1508673
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 00:23:20 -0500 (CDT)
Received: (qmail 19912 invoked by uid 108); 18 Jul 2003 05:26:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13977 invoked from network); 18 Jul 2003 05:20:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180516.h6I5GVjb1477193@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 00:16:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question over Assign 1 (fwd)
Status: O
X-UID: 125
Content-Length: 970
X-Keywords: $NotJunk                                                                                           

>>Dear Venkat,
>>
>>I did not want to send this over the server because I am including my 
>>ModuloCounter.cpp file.  Below is my code for the ModuloCounter.cpp file:
>>
>>#include <iostream>
>>#include "ModuloCounter.h"
>>
>>
>>using namespace std;
>>
.... rest of the code deleted ....
>>
>>I am getting one error and its pointing to:
>>
>>using namespace std;
>>
>>error C2143: syntax error : missing ';' before 'PCH creation point'
>>
>>I really do not understand what I am doing wrong, I have been looking at it 
>>for awhile and do not understand what I am doing wrong.
>>
>>Thank you for your time
>>
>>Sincerely,

>From what you have mentioned, I think you are missing a semicolon
at the end of the class in the .h (header) file. Look at the 
class declartion in the header and make sure it ends with
};

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-130-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 00:24:12 2003
Return-Path: <uhcosc1320-return-130-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I5OB5Z1508748
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 00:24:12 -0500 (CDT)
Received: (qmail 20905 invoked by uid 108); 18 Jul 2003 05:27:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11715 invoked from network); 18 Jul 2003 05:17:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180429.h6I4TFWJ1367713@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:29:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assign 1 Q. (fwd)
Status: O
X-UID: 126
Content-Length: 1530
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>  In the example below, 
> 
>class X
>{
>public:
>X() { val = 0; }
>void setVal(int v)
>{
>val = v;
>}
>int getVal() const
>{
>return val;
>}
>private:
>int val;
>};
>
> 
>void printVal(const X& ref)
>{
>// ref is a reference to what ever is passed to printVal 
>// from main or any other function. This ref is marked as
>// a const. It is a read-only reference. Using it
>// you can call query methods, but you can not call modifiers.
>// In other words, using ref, you can call getVal, in this
>// example. However, you are not allwed to call setVal.
>}
>
>In "ref is a reference to what ever is passed to printVal " statement do you mean ref is a reference to X in this case.
>If so, does ref contain the address of X.
> 
>Could you please clarify.I am sorry for making you to repeat the concept.
> 
>Thanks and Regards.

References do not take up any more space. Pointers take space, references
to not.

When you declare a variable

int a = 4;

a really is a symbolic name for a location in memory.

int* p = &a;

In this case, p is a symbolic name for another location in memory.
This location has as value, the address of the variable whose 
symoblic name is a.

Now, when I create

int& r = a;

r does not have any additional space allocated like p. r is a symolic 
name to the same location in memory as a is. In other words, r and a
are the same.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-131-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 00:27:56 2003
Return-Path: <uhcosc1320-return-131-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I5Rt5Z1520694
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 00:27:55 -0500 (CDT)
Received: (qmail 24014 invoked by uid 108); 18 Jul 2003 05:31:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8636 invoked from network); 18 Jul 2003 05:13:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180442.h6I4g9IE1402016@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:42:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Do we have a class on Friday (fwd)
Status: O
X-UID: 127
Content-Length: 288
X-Keywords: $NotJunk                                                                                           

><DIV>I was wondering if we have a class on Friday. </DIV>

No. 

(This is one eager set of students to meet on Fridays I think).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-132-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 00:32:48 2003
Return-Path: <uhcosc1320-return-132-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I5Wm5Z1532736
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 00:32:48 -0500 (CDT)
Received: (qmail 27958 invoked by uid 108); 18 Jul 2003 05:36:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10956 invoked from network); 18 Jul 2003 04:29:45 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180426.h6I4Q2X71357957@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 17 Jul 2003 23:26:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Compiler issue or language issue (fwd)
Status: O
X-UID: 128
Content-Length: 471
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>When you were demonstrating in class that the print
>function will create an object when you passs a value
>of 1, is this a compiler problem or a C++ language
>problem?
>
>If a compiler problem, does it also appears in .net,
>Borland, and gcc compiler too?

It is a feature of the C++ language.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-133-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 00:38:41 2003
Return-Path: <uhcosc1320-return-133-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6I5cd5Z1548964
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 00:38:41 -0500 (CDT)
Received: (qmail 32646 invoked by uid 108); 18 Jul 2003 05:42:16 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28523 invoked from network); 18 Jul 2003 05:37:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307180509.h6I59jRX1439803@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 00:09:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assignment1 (fwd)
Status: O
X-UID: 129
Content-Length: 1318
X-Keywords: $NotJunk                                                                                           

>I have 2 questions:
>
>1) I'm a little confused with all the requirements of the program. So I just 
>want to verify this: Is part of this assignment to program the logic for 
>printerCounterInfo, printCounterValueAndCount_1, and 
>printCounterValueAndCount_2 but not submit these to you??

These are already given in the file I have given. So, the answer is no.

>2) Also, I keep getting this error when trying to run my program:
>
>Compiling...
>ModCounterMain.cpp
>A:\ModCounterMain.cpp(2) : fatal error C1083: Cannot open include file: 
>'ModuloCounter.h': No such file or directory
>ModuloCounter.cpp
>A:\ModuloCounter.cpp(6) : fatal error C1083: Cannot open include file: 
>'ModuloCounter.h': No such file or directory
>Error executing cl.exe.
>
>Assign1.exe - 2 error(s), 0 warning(s)
>
>Any ideas or hints would help.
>
>Thank you for your time! :)

Make sure you have included ModuloCounter.h in your ModuloCounter.cpp
with the double quote notation (#include "ModuloCounter.h") instead
of the angle bracket (#include <ModuloCounter.h>).

That's the only thing I can think of. If that does not fix it, email
me the code and I will take a look at it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-134-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 07:42:37 2003
Return-Path: <uhcosc1320-return-134-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6ICgb5Z1062107
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 07:42:37 -0500 (CDT)
Received: (qmail 2989 invoked by uid 108); 18 Jul 2003 12:46:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 885 invoked from network); 18 Jul 2003 12:43:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307181235.h6ICZk5v1568078@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 07:35:46 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment1: getNumberofModuloCounters? (fwd)
Status: O
X-UID: 130
Content-Length: 1619
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I have two questions:
>
>1. What exactly is the getNumberofModuloCounters supposed to do? Is just
>returning the value of the limit and placing it in a global variable. If
>so does is it supposed to be a void function? I am confused with what
>its function is.

This function will tell you the number of objects of the ModuloCounters
that have been created and still in existence at the place of call.
You will keep a static variable in your class that will keep count of
number of objects. You will do this by incrementing this variable in the
constructor and decrementing it in the destructor. Refer to the Person
example I gave in class on Monday (July 14th) to learn more about this.

>2. Also I am using Visual C++ .net; when I build the project the windows
>console is supposed to pop and the program is to run, but this not
>happening. The .EXE file is being made but I have use explorer and click
>on the .exe file in the debug folder. When I click the .exe file, it
>runs the program and abruptly closes the window, which makes it
>impossible to see the results. It should normally prompt for a key
>stroke then quit. I had to add a sleep function at the end of main () to
>see the results. All this was working yesterday, it's probably some
>setting? Can you advise me?
>
>Thank You, 

Easiest thing to do is to hit Ctrl + F5 to run within studio.
This should bring up the command window and stop with a press
any key message at the end. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-135-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 07:57:02 2003
Return-Path: <uhcosc1320-return-135-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6ICuv5Z1100677
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 07:57:02 -0500 (CDT)
Received: (qmail 13785 invoked by uid 108); 18 Jul 2003 13:00:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12056 invoked from network); 18 Jul 2003 12:58:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307181228.h6ICSxZS1538486@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 07:28:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Linking question (fwd)
Status: O
X-UID: 131
Content-Length: 1253
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>You were right Venkat, re-writing the different example codes does help
>understand the concepts better. Great tip!

I'm glad you are trying it.

>How ever, I was not able to replicate this error in any examples we had
>in class.My Assignment #1 is compiling fine, but I am getting an error
>when I am building the program.
> 
>This is the error I get:
> 
>error C2662: 'getCounterValue' : cannot convert 'this' pointer from
>'const class ModuloCounter' to 'class ModuloCounter &'
> 
> 
>I do not understand what the error means in "english". Would I have to
>use the "this" pointer in the implementation?
> 
>This is my "getCounterValue" in the implementation:
> 
>            int ModuloCounter::getCounterValue()
>            {
>                        return current_count;
> 
>            }
> 
>Analyzing the main, I see that the "ModuloCounter" is sent differently,
>but will that change the way the method is called? Isn't the method
>still unique to the object that is being passed.
> 
>Look forward to your response.
> 
>Thanks,

The problem is, you are not following the very first rule we wrote it class.
Make a method a const method if possible. getCounterValue is a query method,
should't it be declared a const method?

Venkat

From uhcosc1320-return-136-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 10:09:20 2003
Return-Path: <uhcosc1320-return-136-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6IF9J5Z1450828
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 10:09:19 -0500 (CDT)
Received: (qmail 2809 invoked by uid 108); 18 Jul 2003 15:12:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14307 invoked from network); 18 Jul 2003 14:16:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307181231.h6ICVJK51555801@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 07:31:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 1... (fwd)
Status: O
X-UID: 132
Content-Length: 739
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>I'm having problems getting the correct output after the "printCounterValueAndCount_1(counter)" function is called.
>
>After reading some of the previous emails about this...I think I'm having this problem because ... (rest of the statement deleted)...

Indeed, your observation is correct. This is part of the solution I want
students to find.

... rest of the mail deleted...
You are in the right direction. Only clue I will give you is,
in your function (of interest) you are setting only one variable.
Go ahead and take care of all the variables in the object.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-137-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 10:27:03 2003
Return-Path: <uhcosc1320-return-137-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6IFR25Z1498822
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 10:27:03 -0500 (CDT)
Received: (qmail 20587 invoked by uid 108); 18 Jul 2003 15:30:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17900 invoked from network); 18 Jul 2003 15:27:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307181517.h6IFHW7u1473321@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 10:17:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Const confusion (fwd)
Status: O
X-UID: 133
Content-Length: 1976
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>    I was not having this problem with my program, but your explanation here
>totally cleared things up for me.
>
>Thanks!

I think the thanks goes to the student who asked the right question.
That was a good question.

Venkat

>
>----- Original Message ----- 
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>To: "COSC 1320 Mailing List" <uhcosc1320@agiledeveloper.com>
>Sent: Thursday, July 17, 2003 11:25 PM
>Subject: [uhcosc1320] Const confusion (fwd)
>
>
>> >Venkat,
>> >
>> >Could you please let me know what questions to ask myself when planning
>to develop code with "const" in it?  I am having trouble understanding what
>the const's do in a given position.  I find myself asking does this method
>need a const at the far right or far left or before the variable est..  I
>need help understanding what questions to ask myself to determine what
>const's are needed and where they go.  I hope this question is clear to you.
>I apologize for asking a question that has been beat to death; I just don't
>quite have it yet.
>>
>> Consider a function. const may appear on the far left, in front of
>> an argument, and finally at far right. Here are the questions to ask.
>>
>> 1. Do I want to make sure that the caller of my method does not
>> modify the returned result.
>> Place a const at far left.
>> 2. Do I want to promise that my method does not modify the argument
>> sent to my method.
>> Place a const in front of the argument.
>> 3. Do I want to say that my method is a query method, i.e., it does not
>> modify the object on which it is called.
>> Place a const at the far right.
>>
>> Hope this helps.
>>
>> Venkat Subramaniam
>> -- 
>> cosc155g@bayou.uh.edu Department of Computer Science
>> http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx
>77204-3475
>>
>>
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-138-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 10:56:26 2003
Return-Path: <uhcosc1320-return-138-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6IFuQ5Z1052238
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 10:56:26 -0500 (CDT)
Received: (qmail 18090 invoked by uid 108); 18 Jul 2003 16:00:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17882 invoked from network); 18 Jul 2003 15:27:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307181522.h6IFMUxQ1487018@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 10:22:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assignment1 (fwd)
Status: O
X-UID: 134
Content-Length: 2398
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>    I had the same problem on hw1 as this person is having on assign1. I
>fixed it by changing the #include "ModuloCounter.h" line to;
>
>#include "./ModuloCounter.h"
>
>since it was in the same directory as the ModuloCounter.cpp. I have had
>issues with VC++ 6.0 doing this sometimes. That fixed it for me anyway.
>Assign1 worked with just #include "ModuloCounter" for me... weird.
>
>That is one work around anyway.
>
>Thanks,

Hummm, strange.

Actually, in a later email exchanged individually we figured the problem
was an error in naming the file. 

Venkat
>
>----- Original Message ----- 
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>To: "COSC 1320 Mailing List" <uhcosc1320@agiledeveloper.com>
>Sent: Friday, July 18, 2003 12:09 AM
>Subject: Re: [uhcosc1320] Assignment1 (fwd)
>
>
>> >I have 2 questions:
>> >
>> >1) I'm a little confused with all the requirements of the program. So I
>just
>> >want to verify this: Is part of this assignment to program the logic for
>> >printerCounterInfo, printCounterValueAndCount_1, and
>> >printCounterValueAndCount_2 but not submit these to you??
>>
>> These are already given in the file I have given. So, the answer is no.
>>
>> >2) Also, I keep getting this error when trying to run my program:
>> >
>> >Compiling...
>> >ModCounterMain.cpp
>> >A:\ModCounterMain.cpp(2) : fatal error C1083: Cannot open include file:
>> >'ModuloCounter.h': No such file or directory
>> >ModuloCounter.cpp
>> >A:\ModuloCounter.cpp(6) : fatal error C1083: Cannot open include file:
>> >'ModuloCounter.h': No such file or directory
>> >Error executing cl.exe.
>> >
>> >Assign1.exe - 2 error(s), 0 warning(s)
>> >
>> >Any ideas or hints would help.
>> >
>> >Thank you for your time! :)
>>
>> Make sure you have included ModuloCounter.h in your ModuloCounter.cpp
>> with the double quote notation (#include "ModuloCounter.h") instead
>> of the angle bracket (#include <ModuloCounter.h>).
>>
>> That's the only thing I can think of. If that does not fix it, email
>> me the code and I will take a look at it.
>>
>> Venkat Subramaniam
>> -- 
>> cosc155g@bayou.uh.edu Department of Computer Science
>> http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx
>77204-3475
>>
>>
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-139-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 12:15:33 2003
Return-Path: <uhcosc1320-return-139-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6IHFX5Z1253078
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 12:15:33 -0500 (CDT)
Received: (qmail 5294 invoked by uid 108); 18 Jul 2003 17:19:07 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2820 invoked from network); 18 Jul 2003 17:17:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307181713.h6IHDJrr1256034@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 12:13:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] getCounterLimit question (fwd)
Status: O
X-UID: 135
Content-Length: 986
X-Keywords: $NotJunk                                                                                           

>in the getCounterLimit we are just setting the limit given to the mod limit given correct?  Why when I set the mod limit equal to the limit given I get an l-value error.  But if I switch it to limit equal to mod limit it works perfectly.  My limit given as an argument is defined as ....deleted....
>                                             if I do
>                                                mod=limit;  I get an lvalue error but if I do
>  
>                                                limit=mod;  it works!!
> 
> 
>mod is the modulo limit given as an argument to counter in your main.  

You are getting an error because you may have done the right thing!
If you made the getCounterLimit function as const method, then, it
will not allow you to modify any member variables within that method.
And that is good.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-140-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 12:57:17 2003
Return-Path: <uhcosc1320-return-140-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6IHvG5Z1371074
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 12:57:16 -0500 (CDT)
Received: (qmail 15992 invoked by uid 108); 18 Jul 2003 18:00:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7484 invoked from network); 18 Jul 2003 17:20:52 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307181717.h6IHH7ZI1253551@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 12:17:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Const confusion (fwd)
Status: O
X-UID: 136
Content-Length: 1616
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>    A little off-topic of what we cover in class... Does all of this stuff
>that we are using in class apply to games? I have code for an entire mod of
>a very popular multi-player online game that a friend of mine in England
>sent me. I have been trying to play around with it, you know, add new things
>like weapons, etc., but have found it difficult until taking 1320. Now
>things are starting to make more sense. I have actually gotten a few new
>things to work. It is so much fun to see that happen, and then have 200
>people around the globe telling you how much they like what you have done,
>etc.
>
>    After playing with this game code where you have over 50 files, with a
>lot of them referencing each other, I seem to make my assignments in class
>harder on myself than they need to be. HAHAHA!
>
>    The game coders do not seem to follow the "one class per header file"
>that you and our books say we should try to do. Is there ever a reason to
>not place only one class in a header file?
>
>I know you must be a busy man, so I hope this is not an intrusion of any
>kind.
>
>Thank you for your time,

There is  more to game programming that language used. However, if OO
is being used, then you will surely benefit from what's presented in this
course.

Keeping one class per file is a good habit. But some times, good habits
are hard to come by. In Java, you are forced to do it. In C++, one needs to
have the discipline for that.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-141-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 13:09:20 2003
Return-Path: <uhcosc1320-return-141-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6II9K5Z1403204
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 13:09:20 -0500 (CDT)
Received: (qmail 28776 invoked by uid 108); 18 Jul 2003 18:12:59 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12793 invoked from network); 18 Jul 2003 17:57:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307181718.h6IHIaV41269736@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 12:18:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assignment1 (fwd)
Status: O
X-UID: 137
Content-Length: 3438
X-Keywords: $NotJunk                                                                                           

>I must admit that I use this compiler for my game code, which at times is
>for Linux and other times is windows only.
>
>I notice the weirdness when I use the Linux code and then switch back to
>windows.
>
>Any thoughts? I am not trying to debug my personal stuff...I already work
>around all that.
>
>Just trying to help out where I can.

Sorry, I have no idea on this and am not of much help.

Venkat

>----- Original Message ----- 
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>To: "COSC 1320 Mailing List" <uhcosc1320@agiledeveloper.com>
>Sent: Friday, July 18, 2003 10:22 AM
>Subject: Re: [uhcosc1320] Assignment1 (fwd)
>
>
>> >Venkat,
>> >
>> >    I had the same problem on hw1 as this person is having on assign1. I
>> >fixed it by changing the #include "ModuloCounter.h" line to;
>> >
>> >#include "./ModuloCounter.h"
>> >
>> >since it was in the same directory as the ModuloCounter.cpp. I have had
>> >issues with VC++ 6.0 doing this sometimes. That fixed it for me anyway.
>> >Assign1 worked with just #include "ModuloCounter" for me... weird.
>> >
>> >That is one work around anyway.
>> >
>> >Thanks,
>>
>> Hummm, strange.
>>
>> Actually, in a later email exchanged individually we figured the problem
>> was an error in naming the file.
>>
>> Venkat
>> >
>> >----- Original Message ----- 
>> >From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>> >To: "COSC 1320 Mailing List" <uhcosc1320@agiledeveloper.com>
>> >Sent: Friday, July 18, 2003 12:09 AM
>> >Subject: Re: [uhcosc1320] Assignment1 (fwd)
>> >
>> >
>> >> >I have 2 questions:
>> >> >
>> >> >1) I'm a little confused with all the requirements of the program. So
>I
>> >just
>> >> >want to verify this: Is part of this assignment to program the logic
>for
>> >> >printerCounterInfo, printCounterValueAndCount_1, and
>> >> >printCounterValueAndCount_2 but not submit these to you??
>> >>
>> >> These are already given in the file I have given. So, the answer is no.
>> >>
>> >> >2) Also, I keep getting this error when trying to run my program:
>> >> >
>> >> >Compiling...
>> >> >ModCounterMain.cpp
>> >> >A:\ModCounterMain.cpp(2) : fatal error C1083: Cannot open include
>file:
>> >> >'ModuloCounter.h': No such file or directory
>> >> >ModuloCounter.cpp
>> >> >A:\ModuloCounter.cpp(6) : fatal error C1083: Cannot open include file:
>> >> >'ModuloCounter.h': No such file or directory
>> >> >Error executing cl.exe.
>> >> >
>> >> >Assign1.exe - 2 error(s), 0 warning(s)
>> >> >
>> >> >Any ideas or hints would help.
>> >> >
>> >> >Thank you for your time! :)
>> >>
>> >> Make sure you have included ModuloCounter.h in your ModuloCounter.cpp
>> >> with the double quote notation (#include "ModuloCounter.h") instead
>> >> of the angle bracket (#include <ModuloCounter.h>).
>> >>
>> >> That's the only thing I can think of. If that does not fix it, email
>> >> me the code and I will take a look at it.
>> >>
>> >> Venkat Subramaniam
>> >> -- 
>> >> cosc155g@bayou.uh.edu Department of Computer Science
>> >> http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx
>> >77204-3475
>> >>
>> >>
>> >
>> >
>>
>>
>>
>> Venkat Subramaniam
>> -- 
>> cosc155g@bayou.uh.edu Department of Computer Science
>> http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx
>77204-3475
>>
>>
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-142-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 21:45:50 2003
Return-Path: <uhcosc1320-return-142-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6J2jn5Z1187311
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 21:45:50 -0500 (CDT)
Received: (qmail 32270 invoked by uid 108); 19 Jul 2003 02:49:26 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19994 invoked from network); 19 Jul 2003 02:33:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307190230.h6J2U9So1145863@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 21:30:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Software Extensibility (fwd)
Status: O
X-UID: 138
Content-Length: 648
X-Keywords: $NotJunk                                                                                           

>Mr Venkat
>
>       Can you explain what is software extensibility?. Is Polymorphism and 
>Inheritance examples of C++ OOP paradigm that our extensible.
>
>Thanx

Extensibility is a measure to see if your software system can accomodate
change in requirements. A software system is extensible if a change
in requirement can be accomodated by writing small new modules of code
instead of changing exisiting code. Inheritance and Polymorphism are
concepts in OO that facilitate extensiblity.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-143-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 21:46:22 2003
Return-Path: <uhcosc1320-return-143-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6J2kM5Z1186586
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 21:46:22 -0500 (CDT)
Received: (qmail 371 invoked by uid 108); 19 Jul 2003 02:50:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20454 invoked from network); 19 Jul 2003 02:34:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307190230.h6J2Ubn21146387@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 21:30:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Links to group mails and C++ coding standard (fwd)
Status: O
X-UID: 139
Content-Length: 316
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>Would you mind creating links to the group mails and C++ coding standard 
>pages on the course page?
>
>Thanks,

No problem. Its there now.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-144-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 21:48:38 2003
Return-Path: <uhcosc1320-return-144-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6J2mb5Z1115187
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 21:48:37 -0500 (CDT)
Received: (qmail 2272 invoked by uid 108); 19 Jul 2003 02:52:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29168 invoked from network); 19 Jul 2003 02:45:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307190241.h6J2fjv21172605@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 21:41:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Static example (fwd)
Status: O
X-UID: 140
Content-Length: 1102
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>In the Person class, the method is
>
>static int getNumberOfPersons();
>
>Isn't it better to write it as
>
>const static int& getNumberOfPersons();
>
>That way we don't have to allocate memory on the stack for the returned 
>value and since we are declaring it as const, there is no danger of the 
>static variable, numberofPersons being changed.
>
>Thanks,

Sure, that may be better actually. Generally though with an int,
the saving is not as significant as with an object. So, you do not
see this too often. But I agree with you. What you have given is
more efficient. One small think to be concerned about however.
Let's say you get a reference to the count and it is currently 2.
Now you create another object. Now you look at the reference you
already obtained, it will be 3 and not 2. The question to ask is,
do you want a reference to the count or do you want a snapshot
copy of the count at the instance it is called.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-145-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 21:48:58 2003
Return-Path: <uhcosc1320-return-145-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6J2mw5Z1195650
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 21:48:58 -0500 (CDT)
Received: (qmail 2736 invoked by uid 108); 19 Jul 2003 02:52:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25581 invoked from network); 19 Jul 2003 02:41:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307190237.h6J2bP2d1157997@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 21:37:25 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Midterm (fwd)
Status: O
X-UID: 141
Content-Length: 307
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Will the midterm be open book/notes? Crib sheet?
>
>Thanks,

No crib sheets allowed.
It will be closed book, closed notes and open mind.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-146-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 21:50:54 2003
Return-Path: <uhcosc1320-return-146-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6J2os5Z1196875
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 21:50:54 -0500 (CDT)
Received: (qmail 4311 invoked by uid 108); 19 Jul 2003 02:54:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31653 invoked from network); 19 Jul 2003 02:48:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307190244.h6J2ipFZ1184720@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 21:44:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment 1 constructer problem (fwd)
Status: O
X-UID: 142
Content-Length: 1142
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>         When I call the function void printCounterValueAndCount_1(const 
>ModuloCounter theCounter), theCounter is a newly created ModuloCounter 
>object.  I coded the ModuloCounter constructor so that it increments the 
>static variable, objectcounter.  In all other instances the constructor 
>works but for some reason when this function is called and the ModuloCounter 
>object is created, objectcounter is not incremented.  Below is the 
>constructor I used:
>
>ModuloCounter::ModuloCounter(int limit)
>{
>	modlimit = limit;
>	count = 1;
>	objectcount++;
>}
>
>Thank you.

We spoke about function calls and discussed the issues of call by value
and call by reference. So, start thinking about what happens when
a call by value is involved when the argument type is a class. We spoke
about this at length in class and this is also one of the things for you
to figure out in this assignment as well. The above hints hopefully help you
figure out what is needed.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-147-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 21:51:49 2003
Return-Path: <uhcosc1320-return-147-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6J2pn5Z1199294
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 21:51:49 -0500 (CDT)
Received: (qmail 5095 invoked by uid 108); 19 Jul 2003 02:55:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24987 invoked from network); 19 Jul 2003 02:40:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307190236.h6J2afwM1161479@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 21:36:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Questions on Exam 1 of 2002 (fwd)
Status: O
X-UID: 143
Content-Length: 1241
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>In this test, problem 5 has a code and asks what the given out put is.  My question is about a few particular lines in the code.
>
>the code is:
>
>#include <iostream.h>
>
>class Switch
>{
>public:
>	Switch ()
>		{
>			cout << "Switch::Switch(); << endl;
>			position = false;
>		}
>
>	Switch (const Switch& other)
>		{
>			cout << "Switch::Switch (const Switch& other)" << endl;
>			position = other.position;
>		}
>
>	~Switch ()
>		{
>			cout << "Switch::~Switch()" << endl;
>		}
>
>..........more functions and variables.......
>};
>
>What happens when the main creates an object, say obj?  More specifically, in the constructor what does the line beginning with "cout" do?  And then the same question on the copy constructor and the destuctor.
>
>One more question,  Cout is a function call, correct?  It is not a object of Switch.

When an object is created, the constructor is automatically called.
Within the constructor, cout << is used to output some information to
the standard output. cout is an object of type ostream and it represents
standard output.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-148-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 21:51:57 2003
Return-Path: <uhcosc1320-return-148-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6J2pv5Z1203232
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 21:51:57 -0500 (CDT)
Received: (qmail 5260 invoked by uid 108); 19 Jul 2003 02:55:34 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32718 invoked from network); 19 Jul 2003 02:49:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307190246.h6J2k58Z1179851@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 21:46:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment1 getValue (fwd)
Status: O
X-UID: 144
Content-Length: 512
X-Keywords: $NotJunk                                                                                           

>Venkat, 
>
>How do you return a non-static variable using this function?
>
>int ModuloCounter::getCounterValue()
>{
>	return count;
>}
>
>Count is declared in private as int count.
>
>Thanks, 

You return it exactly like how you have shown. I am not sure what
problem you are having (other than the obvious violation of rules
that need to be followed).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-149-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 18 21:53:36 2003
Return-Path: <uhcosc1320-return-149-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6J2rZ5Z1207714
	for <cosc155g@bayou.uh.edu>; Fri, 18 Jul 2003 21:53:36 -0500 (CDT)
Received: (qmail 6939 invoked by uid 108); 19 Jul 2003 02:57:17 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2224 invoked from network); 19 Jul 2003 02:52:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307190248.h6J2mMSh1193786@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 18 Jul 2003 21:48:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] getCounterLimit question (fwd)
Status: O
X-UID: 145
Content-Length: 638
X-Keywords: $NotJunk                                                                                           

>When the an object is declared is the count value supposed to be
>initialized  as 1 or does it use a static count that takes the value of
>the present count, which may or may not be 1. For example in the
>program, using the main given, as soon anotherCounter is created should
>it's count be 1 or 3(which is what counters is). Here is my code :

...deleted...

If you go to the assignment directory, you will see a file named output
that tell you what output you should expect.
 
Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-150-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 08:00:11 2003
Return-Path: <uhcosc1320-return-150-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6KD0A5Z1223895
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 08:00:11 -0500 (CDT)
Received: (qmail 21105 invoked by uid 108); 20 Jul 2003 13:03:55 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18687 invoked from network); 20 Jul 2003 12:59:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307201255.h6KCtwX41217456@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 07:55:58 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Printing slides 4 per page (fwd)
Status: O
X-UID: 146
Content-Length: 526
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>Is there an easy way to print the slides 4 per page? I saw someone in class 
>who had the slides printed that way but I can't figure it out. I know you 
>can do it in Powerpoint or Adobe Reader but your slides are in jpg format.
>
>Thanks,

I am forwarding this to the class. Hopefully, some one who has tried this
will response with an answer for you.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-151-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 08:04:57 2003
Return-Path: <uhcosc1320-return-151-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6KD4s5Z1220554
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 08:04:54 -0500 (CDT)
Received: (qmail 23581 invoked by uid 108); 20 Jul 2003 13:08:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22208 invoked from network); 20 Jul 2003 13:05:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307201301.h6KD1vN01226459@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 08:01:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Copy Constructors (fwd)
Status: O
X-UID: 147
Content-Length: 850
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I was looking through my notes, and I read where I had written "always =
>write a copy constructor" as a rule.  However, I seem to remember that =
>on another day in one of the lectures you said that we should determine =
>whether or not we need a copy constructor when we are writing a class.  =
>Is the copy constructor always called for, or is it OK to leave it off =
>if a shallow copy is desired?
>
>Thank you,

In theory, if shallow copy is enough, you do not need to write a 
copy constructor. In practise however, you will eventually find that
you need it and it is better to write. We will talk about law of big three
soon, and it pretty much says you need to write it. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-152-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 08:06:06 2003
Return-Path: <uhcosc1320-return-152-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6KD665Z1231593
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 08:06:06 -0500 (CDT)
Received: (qmail 24313 invoked by uid 108); 20 Jul 2003 13:09:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21530 invoked from network); 20 Jul 2003 13:04:29 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307201300.h6KD0YHQ1223948@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 08:00:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] doubt with pointers and strings combination (fwd)
Status: O
X-UID: 148
Content-Length: 2036
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>    I have a problem with the following program.
>#include<iostream.h>
>void main()
>{
>   char* s="hello";
>   *s='l';//This is the line where i am getting problem.
>   cout<<*s;
>   s="hai";
>   cout<<s;
>
>}
>       This is a program i found in one of the C++ text books I have. When
>       i run this program without the problematic line ( the line I
>       indicated in the program) it runs well. When i add the problematic
>       line there are no compilation errors. But when i run the program
>       then a pop-up dialog box of microsoft comes up saying
>       "main.cpp(which is the name of the main program) has encountered a
>       problem and it needs to be closed down". This is the same dialog
>       box which asks us whether we need to report the error to microsoft
>       or not. I am using microsoft visual C++ 6.0 compiler.
>According to the book i have to get an output "l" for the first cout and
>"hai" for the second cout. Can you point out to me where i am wrong.
>Thanks in advance.

When you create 

char* s = "hello";

A pointer ("s") is allocated on the stack. It refers to a string literal
or constant. Now, lets say I write

char* s1 = "hello";

You will notice that s and s1 both point to the same location. 
The hello itself is a string constant and can not be changed.
If you want to change it, you will have to create it on the heap
like

char* s3 = new char[6];
strcpy(s3, "hello");

In the case of s, you will notice that the address that s points to
is far from the stack memory where s is created (i.e., &s) or the
heap memory as well (where s3 is pointing to). This is the program
area and not the data area of memory (logical separation). Your 
process (program under execution) does not have permission to write to
this memory region. This is why you get the error when you try to 
modify the data at that location.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-153-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 08:09:54 2003
Return-Path: <uhcosc1320-return-153-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6KD9n5Z1233891
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 08:09:49 -0500 (CDT)
Received: (qmail 26246 invoked by uid 108); 20 Jul 2003 13:13:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18399 invoked from network); 20 Jul 2003 12:59:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307201255.h6KCtLu11218389@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 07:55:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] HW2
Status: O
X-UID: 149
Content-Length: 235
X-Keywords: $NotJunk                                                                                           

Greetings,

HW2 has been posted. Hard copy of it is due on Thursday.

Enjoy.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-154-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 08:19:20 2003
Return-Path: <uhcosc1320-return-154-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6KDJI5Z1247553
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 08:19:18 -0500 (CDT)
Received: (qmail 31789 invoked by uid 108); 20 Jul 2003 13:23:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31420 invoked from network); 20 Jul 2003 13:22:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307201318.h6KDIVKO1246212@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 08:18:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] read-only pointers and married pointers?
Status: O
X-UID: 150
Content-Length: 1352
X-Keywords: $NotJunk                                                                                           

>Dr.Venkat,
>
>Will you please explain again about read-only pointers and married pointers. I am still confused.  Thank You

Please use a clear subject line when sending emails.

There are quite a few combinations (and effects) when it comes to using
Pointers with const.

int x = 5;
int y = 6;
int z = 7;

const int* ptr1 = &x;
int* const ptr2 = &x;
const int* const ptr3 = &x;

ptr1 is a read-only pointer. It may point to any int x, y, z, etc. It 
can tell you what the value of the int is. It can not be used to change
this value. 

It is incorrect to say that ptr1 point to a const value. I can change 
the value of x. A more appropriate statement is - ptr1 can not be used
to change the value of x or ptr1 treats the value as a constant. 

	ptr1 = &z; 	// OK
	y = *ptr1;  	// OK
	*ptr1 = 5;	// Error
	*ptr1 = z;	// Error

ptr2 is married to x. It always points to the address of x. You may use
ptr2 to read and change the value, but you can not change the pointer 
itself.

	ptr2 = &z; 	// Error
	y = *ptr2;  	// OK
	*ptr2 = 5;	// OK
	*ptr2 = z;	// OK

ptr3 is a read-only pointer that is married to x.

	ptr3 = &z; 	// Error
	y = *ptr3;  	// OK
	*ptr3 = 5;	// Error
	*ptr3 = z;	// Error

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-155-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 09:14:24 2003
Return-Path: <uhcosc1320-return-155-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6KEEM5Z1299321
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 09:14:22 -0500 (CDT)
Received: (qmail 27623 invoked by uid 108); 20 Jul 2003 14:18:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27345 invoked from network); 20 Jul 2003 14:17:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307201413.h6KEDfQ31296936@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 09:13:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Printing slides 4 per page (fwd)
Status: O
X-UID: 151
Content-Length: 1528
X-Keywords: $NotJunk                                                                                           

>I print my slides 4 per page.  I use Internet Explorer on Windows XP.  On my
>system, what I do is:
>1.  From the File menu, choose Print...
>2.  From the General tab, click the Preferences button.
>3.  On the Layout tab, you can choose the number of Pages per Sheet.
>
>It may work differently on Windows 98, 2000, or NT.  I would think that you
>if you don't have the same interface as what you see on XP, then you could
>probably get there by choosing Print Setup.  I hope this helps.

Cool. Thanks for sharing this with the class.

Regards,

Venkat

>----- Original Message -----
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>To: "COSC 1320 Mailing List" <uhcosc1320@agiledeveloper.com>
>Sent: Sunday, July 20, 2003 7:55 AM
>Subject: [uhcosc1320] Printing slides 4 per page (fwd)
>
>
>> >Hi Venkat,
>> >
>> >Is there an easy way to print the slides 4 per page? I saw someone in
>class
>> >who had the slides printed that way but I can't figure it out. I know you
>> >can do it in Powerpoint or Adobe Reader but your slides are in jpg
>format.
>> >
>> >Thanks,
>>
>> I am forwarding this to the class. Hopefully, some one who has tried this
>> will response with an answer for you.
>>
>> Venkat Subramaniam
>> --
>> cosc155g@bayou.uh.edu Department of Computer Science
>> http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx
>77204-3475
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-156-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 12:26:06 2003
Return-Path: <uhcosc1320-return-156-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6KHQ65Z1231228
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 12:26:06 -0500 (CDT)
Received: (qmail 6439 invoked by uid 108); 20 Jul 2003 17:29:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5881 invoked from network); 20 Jul 2003 17:29:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307201725.h6KHPDkg1336557@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 12:25:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Printing slides 4 per page (fwd)
Status: O
X-UID: 152
Content-Length: 2401
X-Keywords: $NotJunk                                                                                           

>An easier way is to actually post the ppt file itself. I noticed it was
>under 500k, where-as the slides are jpeg and rather large (for us modem
>users). By opening the ppt, we can manipulate it to 6 or even 8 slides
>per page (saving paper).
>
>Just a suggestion.
>

Sorry, ppt will not be posted. Future posts will be in pdf though. For 
what's out there I will not spend any more time reposting them in any
other format.

Venkat

>-----Original Message-----
>From: Dr. Venkat Subramaniam [mailto:cosc155g@Bayou.UH.EDU] 
>Sent: Sunday, July 20, 2003 9:14 AM
>To: COSC 1320 Mailing List
>Subject: Re: [uhcosc1320] Printing slides 4 per page (fwd)
>
>>I print my slides 4 per page.  I use Internet Explorer on Windows XP.
>On my
>>system, what I do is:
>>1.  From the File menu, choose Print...
>>2.  From the General tab, click the Preferences button.
>>3.  On the Layout tab, you can choose the number of Pages per Sheet.
>>
>>It may work differently on Windows 98, 2000, or NT.  I would think that
>you
>>if you don't have the same interface as what you see on XP, then you
>could
>>probably get there by choosing Print Setup.  I hope this helps.
>
>Cool. Thanks for sharing this with the class.
>
>Regards,
>
>Venkat
>
>>----- Original Message -----
>>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>>To: "COSC 1320 Mailing List" <uhcosc1320@agiledeveloper.com>
>>Sent: Sunday, July 20, 2003 7:55 AM
>>Subject: [uhcosc1320] Printing slides 4 per page (fwd)
>>
>>
>>> >Hi Venkat,
>>> >
>>> >Is there an easy way to print the slides 4 per page? I saw someone
>in
>>class
>>> >who had the slides printed that way but I can't figure it out. I
>know you
>>> >can do it in Powerpoint or Adobe Reader but your slides are in jpg
>>format.
>>> >
>>> >Thanks,
>>>
>>> I am forwarding this to the class. Hopefully, some one who has tried
>this
>>> will response with an answer for you.
>>>
>>> Venkat Subramaniam
>>> --
>>> cosc155g@bayou.uh.edu Department of Computer Science
>>> http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx
>>77204-3475
>>
>>
>
>
>
>Venkat Subramaniam
>--				
>cosc155g@bayou.uh.edu		Department of Computer Science
>http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx
>77204-3475
>
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-157-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 12:26:35 2003
Return-Path: <uhcosc1320-return-157-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6KHQY5Z1235641
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 12:26:35 -0500 (CDT)
Received: (qmail 6890 invoked by uid 108); 20 Jul 2003 17:30:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6222 invoked from network); 20 Jul 2003 17:29:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307201725.h6KHPbQP1233382@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 12:25:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] is aggregation in the test (fwd)
Status: O
X-UID: 153
Content-Length: 345
X-Keywords: $NotJunk                                                                                           

>hi venkat
>did u say yestrerday that we will cover until slide 5 in the mid term? i was 
>not sure if containment and aggregation is also covered.
>thnaks

No, that is not in the exam. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-158-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 17:09:36 2003
Return-Path: <uhcosc1320-return-158-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6KM9a5Z1419591
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 17:09:36 -0500 (CDT)
Received: (qmail 19052 invoked by uid 108); 20 Jul 2003 22:13:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18750 invoked from network); 20 Jul 2003 22:12:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307202209.h6KM90Nv1418954@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 17:09:00 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 2 posted
Status: O
X-UID: 154
Content-Length: 362
X-Keywords: $NotJunk                                                                                           

Greetings,

Assignment 2 has been posted. It is due midnight Sunday July 26th.
Earlier today I posted HW2 as well.

Hope this furthers your understanding of the concepts discussed in this 
course. Enjoy.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-159-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:11:58 2003
Return-Path: <uhcosc1320-return-159-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4Bv5Z1279408
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:11:57 -0500 (CDT)
Received: (qmail 26818 invoked by uid 108); 21 Jul 2003 04:15:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25088 invoked from network); 21 Jul 2003 04:12:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210408.h6L48qFN1270080@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:08:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assignment 2 posted (fwd)
Status: RO
X-UID: 155
Content-Length: 1763
X-Keywords: $NotJunk                                                                                           

>do you mean sunday (july 27th) or saturday (july 26th)??

Oops. Thanks for alerting me. It is Sunday July 27th midnight.

Venkat

>
>"Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU> wrote:Greetings,
>
>Assignment 2 has been posted. It is due midnight Sunday July 26th.
>Earlier today I posted HW2 as well.
>
>Hope this furthers your understanding of the concepts discussed in this 
>course. Enjoy.
>
>Venkat Subramaniam
>-- 
>cosc155g@bayou.uh.edu Department of Computer Science
>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475
>
>
>---------------------------------
>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>--0-1119287464-1058739494=:19978
>Content-Type: text/html; charset=us-ascii
>
><DIV>do you mean sunday (july 27th) or saturday (july 26th)??<BR><BR><B><I>"Dr. Venkat Subramaniam" &lt;cosc155g@Bayou.UH.EDU&gt;</I></B> wrote:
><BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid; WIDTH: 100%">Greetings,<BR><BR>Assignment 2 has been posted. It is due midnight Sunday July 26th.<BR>Earlier today I posted HW2 as well.<BR><BR>Hope this furthers your understanding of the concepts discussed in this <BR>course. Enjoy.<BR><BR>Venkat Subramaniam<BR>-- <BR>cosc155g@bayou.uh.edu Department of Computer Science<BR>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475</BLOCKQUOTE></DIV><p><hr SIZE=1>
>Do you Yahoo!?<br>
><a href="http://pa.yahoo.com/*http://rd.yahoo.com/evt=1207/*http://promo.yahoo.com/sbc/">SBC Yahoo! DSL</a> - Now only $29.95 per month!
>--0-1119287464-1058739494=:19978--
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-160-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:12:29 2003
Return-Path: <uhcosc1320-return-160-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4CS5Z1275291
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:12:28 -0500 (CDT)
Received: (qmail 27269 invoked by uid 108); 21 Jul 2003 04:16:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25695 invoked from network); 21 Jul 2003 04:13:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210409.h6L49xTq1268786@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:09:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Printing slides 4 per page (fwd)
Status: O
X-UID: 156
Content-Length: 221
X-Keywords: $NotJunk                                                                                           

>If you are printing the slides from the 5th floor computers, you go to Print 
>and in the dialog box, click on the Options tab.  In one of the dialog boxes, 
>it is selected as 1UP but you have to change it to read 4UP.

From uhcosc1320-return-161-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:18:58 2003
Return-Path: <uhcosc1320-return-161-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4Iv5Z1285184
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:18:57 -0500 (CDT)
Received: (qmail 31215 invoked by uid 108); 21 Jul 2003 04:22:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29479 invoked from network); 21 Jul 2003 04:19:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210415.h6L4Fexl1283149@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:15:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question on one of old tests?? (fwd)
Status: O
X-UID: 157
Content-Length: 1810
X-Keywords: $NotJunk                                                                                           

>hello Venkat,
>
>Can you tell me if this code is correct?  This question is in
>one of the tests.  I added to the code given, a destructor, and
>a Copy Constructor.  Since one object is assigned to another
>object in main().  But I'm not sure if I'm doing it right.
>
>here is the code and the modifications that I did are commented
>out using //
>
>#include <iostream.h>
>class Engine {
>private:// I made power private
>            int power;
>public:
>            Engine() { power = 100; }
>            void setPower(int pwr) { power = pwr; }
>            int getPower() const { return power; }
>};
>class Car {
>            Engine* pEngine;
>public:
>            Engine* accessEngine() { return pEngine; }
>            Car()
>		{
>		     pEngine = new Engine;
>		}
>   	~Car()//Destructor added
>	{
> 	delete pEngine;
>	}
>	Car(const Car& other)//Copy Costructor added
>	{
> 	pEngine = other.pEngine;//here on this level of idirection
>                   //is where I am not sure

No this is not correct. You need to set pEngine to the address of 
a copy of the other car's engine and not to the address of the
other car's Engine. 

	pEngine = new Engine(*other.pEngine);

	or 

	pEngine = other.pEngine->createNewEngine();

	where createNewEngine is a method on the Engine class, if I may
	write one.
>	}
>};
>void main()
>{
>            Car c1;
>            Car c2 = c1;
>            c2.accessEngine()->setPower(200);
>            cout << c1.accessEngine()->getPower() << endl;
>            cout << c2.accessEngine()->getPower() << endl;
>}
>
>
>Thank you for the extrea time that you take to answer all of our
>question.

You are most welcome.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-162-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:25:53 2003
Return-Path: <uhcosc1320-return-162-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4Pq5Z1314432
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:25:53 -0500 (CDT)
Received: (qmail 2892 invoked by uid 108); 21 Jul 2003 04:29:45 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30249 invoked from network); 21 Jul 2003 04:21:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210417.h6L4H6D11292925@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:17:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Benefits of Encapsulation (fwd)
Status: O
X-UID: 158
Content-Length: 717
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>In one of the previous exams there is a question about the benefits of encapsulation. Besides these which other ones would be correct to add to the answer:-
>1. Protects an objects data from corruption.

I would state this as makes the system more robust.

>2. It separates how an object behaves from how it is implemented.

I like that one.

>3. Details of an object can be changed without affecting the application that is using it.

Good one.

>4. Hides the details and makes complex classes easy to use.

Sounds good.

>Thanks alot.

:)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-163-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:27:43 2003
Return-Path: <uhcosc1320-return-163-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4Rh5Z1318829
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:27:43 -0500 (CDT)
Received: (qmail 4014 invoked by uid 108); 21 Jul 2003 04:31:35 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1574 invoked from network); 21 Jul 2003 04:27:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210423.h6L4NUWf1308661@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:23:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] encapsulation, static,  initialization list!! (fwd)
Status: O
X-UID: 159
Content-Length: 1465
X-Keywords: $NotJunk                                                                                           

>hello venkat...
>i know that is getting late to ask questions, but hope that you can reply before the exam time... 
> 
>we really having some concerns about encapsulation.. is what is given in the slide enough, or please would you tell us what are the benefits of encapsulation..

What's given in the slides is not enough! We discussed quite a bit in class.
In the last email, a student summerized it fairly well.

>second, what can a static function access and what it can't compared to non static function..
> 

Static function can directly access only static fields/member variables defined 
in a class while non-static functions can access both static and instance 
fields/ member variables defined in a class.

>what are the situations when we will have to use an initialization list when writing a constructor..

This is not covered in the exam, but it is part of HW2 and I will have to
let you answer this one as it is part of the HW now.

>are we supposed to know in details about inheritance and polymorphism for tomorrow's exam..
> 

No.

>thank you much and we really appreciate your time and effort on these emails because it is helping so much... 

I'm glad to be able to provide this and am delighted that you are
asking questions to learn more. This is the sole intent of this mailing list.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-164-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:32:44 2003
Return-Path: <uhcosc1320-return-164-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4Wi5Z1330849
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:32:44 -0500 (CDT)
Received: (qmail 7057 invoked by uid 108); 21 Jul 2003 04:36:31 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4961 invoked from network); 21 Jul 2003 04:32:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210428.h6L4SrDo1319624@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:28:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Destructor and Static... (fwd)
Status: O
X-UID: 160
Content-Length: 2650
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>In HW 1 in the function:
>
>const char* Microwave::status()
>
>...this function is pointing to a string on the heap right?
>
>If so, how would I write a destructor for this function?
>
>Here is my code for this function: Microwave.cpp
>
>const char* Microwave::status()
>{
>	int secondsLeft;
>
>	time_t currentTime3;
>	time(&currentTime3);
>
>	if (isStillRunning)
>		secondsLeft = (int)difftime(begin, currentTime3);
>
>	else
>		secondsLeft = (int)difftime(begin, end);
>
>	if (secondsLeft <= 0)     // if secondsLeft is negative, then the Microwave
>		isStillRunning = 0;   // is not in use
>
>	if (isStillRunning)
>	{
>		sprintf(msg, "Microwave in use. %d seconds left.", secondsLeft);
>		return msg;
>	}
>	
>	else
>		return "Microwave not in use";
>
>}
>
>here is my Microwave.h file:
>
>class Microwave
>{
>public:
>	Microwave();                     // constructor
>	~Microwave();                    // destructor
>
>	int start(int seconds);          // starts the Microwave
>	void stop();                     // stops the Microwave
>	const char* status();            // checks if Microwave is still running
>
>private:
>	long int begin;                  // begin and notes system's clock
>	long int end;                    // ends microwave and notes system's clock
>	bool isStillRunning;             // returns 1 or 0
>	char msg[20];                    // message sent to main
>};

The way you have written, the msg is an array on the stack (if the 
object is created on the stack). You do not have to destroy it 
in the destructor. However, there is a small problem. You should
have declared status as a query method (const method). If you 
declare status as const method (with const on the far right that is),
then the compiler will not allow change to msg within status. You 
then have two options. One is to put the word mutable in front of
the char msg[20] (we will talk about mutable later). Or  you could
write char* msg; and in the constructor initialize msg to 
refer to an array on the heap as
	msg = new char[20];

and in the destructor you would delete it as

	delete[] msg;

>Also, in class you mentioned something about the "static method cannot touch the instances method"
>
>...can you clarify this and what is an "instances method"?
>
>Thank you.

The previous email discussed this one. An instance method is a method
of a class that is not declared static. It is a method that will be
called on an object while static method is never called on an object.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-165-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:36:26 2003
Return-Path: <uhcosc1320-return-165-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4aQ5Z1177496
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:36:26 -0500 (CDT)
Received: (qmail 9414 invoked by uid 108); 21 Jul 2003 04:40:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6388 invoked from network); 21 Jul 2003 04:35:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210431.h6L4VRjX1328705@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:31:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Midterm Question (fwd)
Status: O
X-UID: 161
Content-Length: 1227
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>In one of your old exams there is the following question:
>
>4. Given a pointer within an object, C++ runtime could have been written to
>delete the pointed object automatically. Why are we required to write a
>destructor?
>
>My answer would be:
>
>We don't know if the given pointer was created on the stack or the heap. If
>it was one the stack, no destructor would be needed, but if it was on the
>heap (by means of 'string = new char[5]'), then the destructor would be the
>only way to remove the object from memory.
>
>Is this an accurate answer? Or am I missing something?

I like your answer. There is another one though. Given a pointer, 
you have no idea if it points to an object that it associates or
if it points to an object that it aggregates. So, it can not 
arbitrarily delete it. You are not expected to know this for your midterm 1
however.

>As a separate question,
>
>How else could we create an allocation of memory in the heap by means other
>than "new ... "?
>
>Thanks,

You could use malloc as in C, but I would not recommend that. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-166-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:41:44 2003
Return-Path: <uhcosc1320-return-166-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4fi5Z1354242
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:41:44 -0500 (CDT)
Received: (qmail 12392 invoked by uid 108); 21 Jul 2003 04:45:31 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8937 invoked from network); 21 Jul 2003 04:39:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210435.h6L4Zdfn1338526@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:35:39 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] review questions (fwd)
Status: O
X-UID: 162
Content-Length: 813
X-Keywords: $NotJunk                                                                                           

>I got a couple of questions on mind.  
>
>Q1)  What are the benefits of encapsulation?  The only thing I can come up with is information hiding, seperation of interface from implementation, and user can't directly access private members. Anything else?

Please refer to previous email about this.

>Q2)  Should we be able to do problem 7 of summer 2002 dated July 19, 2002?  

Yes and it was in a previous email sent out a few minutes ago.

>Q3)  And should we be able to know whats going on when we have a class which also involves another class, like the above problem?  
>Thanks. 

I think you should, at least to the extent of the above problem. :) 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-167-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:44:47 2003
Return-Path: <uhcosc1320-return-167-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4ik5Z1359739
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:44:46 -0500 (CDT)
Received: (qmail 14158 invoked by uid 108); 21 Jul 2003 04:48:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12124 invoked from network); 21 Jul 2003 04:44:49 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210440.h6L4epsX1338830@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:40:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment 2 - string constructor (fwd)
Status: O
X-UID: 163
Content-Length: 560
X-Keywords: $NotJunk                                                                                           

>There is supposed to be a String class constructor on assignment 2 that takes an argument.  You said it should be array that is taken, but that seems not likely, I would think you meant a char pointer.  

A char pointer points to an array of characters?!

>Is it an array or a pointer and if it is an array how many characters would you prefer?

This is not set. It could be any number of characters.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-168-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:45:45 2003
Return-Path: <uhcosc1320-return-168-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4ji5Z1363421
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:45:45 -0500 (CDT)
Received: (qmail 14787 invoked by uid 108); 21 Jul 2003 04:49:31 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11343 invoked from network); 21 Jul 2003 04:43:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210439.h6L4dYku1344717@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:39:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] previous exam question (fwd)
Status: O
X-UID: 164
Content-Length: 817
X-Keywords: $NotJunk                                                                                           

>I was working problem 5 from midterm 1 of summer 2001, and I was wondering if the following answer to the problem is correct.
>
>class String {
>public: 
>     String(const char *);

Yes, you need this (above constructor).

>     String();

Nope, this should not be there.

>     String(const String&);

Looks ok.

>     getString()const;

Return type is missing. Should be const char* getString() const;

>     setStrings(const char *);

Return type is missing. Should be void setString(const char*)
>};

I would also have 
private:
	char* pStr;

within the class.

>
>I was assuming that we only needed to write the String.h and not String.cpp.  
>Thanks.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-169-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:47:49 2003
Return-Path: <uhcosc1320-return-169-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4ln5Z1369269
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:47:49 -0500 (CDT)
Received: (qmail 16097 invoked by uid 108); 21 Jul 2003 04:51:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13974 invoked from network); 21 Jul 2003 04:48:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210444.h6L4iFot1357866@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:44:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] old exam problem (fwd)
Status: O
X-UID: 165
Content-Length: 865
X-Keywords: $NotJunk                                                                                           

>On problem 8 dated summer 2000 from midterm 1, I got partially the correct answer.  The results turns out to be the following:
>
>Dice(int a)
>Dice(const Dice& other)
>In f1()
>~Dice
>In f2()
>Dice(int a)
>Dice(const Dice& other)
>Dice(int a)
>Dice(int a)    //  Where did this come from???
>In f2()
>~Dice()       //  When was the destructor called???
>Done
>...
>
>
>Can you explain to me the two areas of concern to me mentioned in the above solution?  Thank you.

Since the constructor for Dice (Dice (int a)) is not explicit,
when call to f2(4) is seen, the compiler promotes the 4 to a Dice
object by calling the constructor. It then invokes f2 and then
destroys the object at the end of call to f2.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-170-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 20 23:49:39 2003
Return-Path: <uhcosc1320-return-170-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6L4nb5Z1374166
	for <cosc155g@bayou.uh.edu>; Sun, 20 Jul 2003 23:49:39 -0500 (CDT)
Received: (qmail 17243 invoked by uid 108); 21 Jul 2003 04:53:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15454 invoked from network); 21 Jul 2003 04:50:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307210446.h6L4kKRZ1365780@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 20 Jul 2003 23:46:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question about test format? (fwd)
Status: O
X-UID: 166
Content-Length: 796
X-Keywords: $NotJunk                                                                                           

>Dear Venkat--
>
>i was wondering why on the test code questions the
>implementation of member functions are implemented in
>the class interface and not seperate. is this because
>it would take up too much room if you encapsulated the
>interface seperate of the implementation and main? i
>suppose the test would be too many pages? is this so?
>
>thanks for your time,

Indeed. This is what I mentioned in class as well. I do not
always follow the nice conventions because it may take
too much space in the exam to do that. When it comes to
your response, I generally instruct you as to what should be done
and expect you to follow that.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-171-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 05:42:44 2003
Return-Path: <uhcosc1320-return-171-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LAgh5Z1197354
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 05:42:43 -0500 (CDT)
Received: (qmail 9308 invoked by uid 108); 21 Jul 2003 10:46:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1351 invoked from network); 21 Jul 2003 10:34:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211030.h6LAUbkC1167612@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 05:30:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] midterm 1 questions (fwd)
Status: O
X-UID: 167
Content-Length: 1134
X-Keywords: $NotJunk                                                                                           

>I got a couple questions to ask
>
>1.  What does "const* int ptr" mean?

This should result in a compilation error.

>2.  On problem 7 from midterm 1 dated summer of 1998, can you explain to me what is going on when function1(function3()); is called.  I ran the program and got something other than expected.  I expected that first a constructor would be called, then the printing of "In function3", followed by a return of obj3 to function 1, and then the call to the destructor because we have left the block of function3.  What the real output is that the last destructor mentioned doesn't happen til later.  Can you explain to me how this is so?  Thanks.
>

The C++ compiler can optimize the calls when  it sees a sequence
of calls to constructor followed by copy consturctor exists. It 
may decide to eliminate copying a temporary object. This behavior
is fairly compilcated and in the exam I would accept the answer
which does not consider these optimizations as well.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-172-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 05:46:32 2003
Return-Path: <uhcosc1320-return-172-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LAkW5Z1201947
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 05:46:32 -0500 (CDT)
Received: (qmail 11794 invoked by uid 108); 21 Jul 2003 10:50:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11332 invoked from network); 21 Jul 2003 10:49:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211045.h6LAjiJ61205649@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 05:45:44 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] old exam problem (fwd)
Status: O
X-UID: 168
Content-Length: 1295
X-Keywords: $NotJunk                                                                                           

>> >On problem 8 dated summer 2000 from midterm 1, I got partially the correct 
>> answer.  The results turns out to be the following:
>> >
>> >Dice(int a)
>> >Dice(const Dice& other)
>> >In f1()
>> >~Dice
>> >In f2()
>> >Dice(int a)
>> >Dice(const Dice& other)
>> >Dice(int a)
>> >Dice(int a)    //  Where did this come from???
>> >In f2()
>> >~Dice()       //  When was the destructor called???
>> >Done
>> >...
>> >
>> >
>> >Can you explain to me the two areas of concern to me mentioned in the above 
>> solution?  Thank you.
>> 
>> Since the constructor for Dice (Dice (int a)) is not explicit,
>> when call to f2(4) is seen, the compiler promotes the 4 to a Dice
>> object by calling the constructor. It then invokes f2 and then
>> destroys the object at the end of call to f2.
>> 
>> Venkat Subramaniam
>> 
>There is another problem 9 (b) :how to make a change if do not want this line 
>( I suppose it is f2(4) ) to be compiled? I haven't find the solution yet, 
>would you please give a hint. Thanks a lot 

It is in the above response already! You would mark the constructor
explicit to avoid call to f2(4) creating an object.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-173-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 05:47:27 2003
Return-Path: <uhcosc1320-return-173-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LAlQ5Z1209212
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 05:47:27 -0500 (CDT)
Received: (qmail 12592 invoked by uid 108); 21 Jul 2003 10:51:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8713 invoked from network); 21 Jul 2003 10:45:48 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211041.h6LAfmqd1195545@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 05:41:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Person Program (fwd)
Status: O
X-UID: 169
Content-Length: 2371
X-Keywords: $NotJunk                                                                                           

>Hello Svenkat,

Misspelling my name does not offend me. However, generally before I 
send an email, I try to verify the name of the person, especially if
the name is some thing I am not familiar with. This goes a long way
in professional relationships. Every email I send has my name in it.
It should take you little effort to get it correct!

>Please look at the code here
>
>
>#include <iostream.h>
>
>class Person
>{
>public:
>	Person() {numberOfPersons++;}
>	~Person(){numberOfPersons--;}
>	static int getNumberOfPersons() {return
>numberOfPersons;}
>private:
>	static int numberOfPersons;
>
>};
>
>int Person::numberOfPersons = 0;
>
>void	main()
>{
>	cout<<Person::getNumberOfPersons() << endl;
>	Person p1;
>	cout <<Person::getNumberOfPersons() << endl;
>	Person p2;
>	cout <<Person::getNumberOfPersons() << endl;
>	{
>		Person p3;
>		cout <<Person::getNumberOfPersons() << endl;
>	}
>1)	cout <<Person::getNumberOfPersons() << endl;
>	{
>		Person p4;
>2)		cout <<Person::getNumberOfPersons() << endl;
>	}
>3)	cout <<Person::getNumberOfPersons() << endl;
>}
>
>
>Here is my question
>In line 1) ( as i marked) the output is 2 why?  how
>they know to call ~person(){NumberOfPerson--}?

Right before line 1, in the inner block Person p3 was created and destroyed. 
When you stepped out of the inner block, p3 was destroyed and its
destructor was called automatically.

>In line 2)  the output is 3 why?

At this point, the following objects are alive: p1, p2 and p4.

>In line 3)  the output is 2 why?

At this point, the following objects are alive: p1, p2. p4 is dead on
stepping out of the } before line 3.

>I don't know why these output like that why they call
>Person() and when they call ~Person().
>
>If i want to have output like this:
>0
>1
>2
>3
>2
>1 
>how i write the code for it?
>
>Thanks

If you want to above mentioned output, you can write

void main()
{
	cout <<Person::getNumberOfPersons() << endl;
	Person p1;
	cout <<Person::getNumberOfPersons() << endl;
	{
		Person p2;
		cout <<Person::getNumberOfPersons() << endl;
		{
			Person p3;
			cout <<Person::getNumberOfPersons() << endl;
		}
		cout <<Person::getNumberOfPersons() << endl;
	}
	cout <<Person::getNumberOfPersons() << endl;
}


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-174-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 05:48:52 2003
Return-Path: <uhcosc1320-return-174-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LAmp5Z1212889
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 05:48:52 -0500 (CDT)
Received: (qmail 13652 invoked by uid 108); 21 Jul 2003 10:52:45 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9963 invoked from network); 21 Jul 2003 10:47:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211043.h6LAhQJW1199520@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 05:43:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] old exam problem (fwd)
Status: O
X-UID: 170
Content-Length: 885
X-Keywords: $NotJunk                                                                                           

>For the following question, what are you looking for when you ask if the lines are valid or not?

I am expecting you to say if the statement of interest will compile
or will the compiler give an error on it.

>Which of the following lines are valid (Write "OK" or "Error")?
>void foo1(Switch obj){
>	obj.getPosition();			//________________________
>	obj.TurnOn();			//________________________
>}
>void foo2(const Switch& obj){
>	obj.getPosition();			//________________________
>Switch obj2; 			//________________________
>obj2.TurnOn();			//________________________
>obj.TurnOn();			//________________________
>}
> void foo3(){
>Switch obj; 			//________________________
>int p = obj.position; 		//________________________
>}

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-175-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 05:55:27 2003
Return-Path: <uhcosc1320-return-175-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LAtR5Z1226545
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 05:55:27 -0500 (CDT)
Received: (qmail 17882 invoked by uid 108); 21 Jul 2003 10:59:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16425 invoked from network); 21 Jul 2003 10:57:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211053.h6LAr1DU1223933@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 05:53:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubts Regarding Operator Overloading (fwd)
Status: O
X-UID: 171
Content-Length: 1465
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> 
>I have few doubts regarding the operator overloading examples which you discussed in Thursday's class.I understood the operator overloading for addition(c1+c2) and subtraction(c1-c2) of complex objects.But i did not understand the operator overloading for (c1+2.1) and (2.1+c1).I tried understanding the programs.But i am baffled.I am sorry for asking you about those things because you took much pain to explain that program.
> 
>Thanks and Regards.

When  you consider c1 + 2.1, there are two ways to achieve this.

One, you may write an overloaded operator+ for complex and double.
You can write this as a global or a member function. However, that
is not even needed. You can simply utilize the feature of user defined
conversion. If there is a operator+ for complex + complex, and if
there is a constructor of Complex that can take a double as an argument,
then the compiler will promote 2.1 to a complex object using the
constructor and then call the operator+ for complex + complex.

Similarly, for 2.1 + c1. The only difference in this case is,
it does the above trick only if operator+ for complex + complex
is a global function. If that was a member function, it does
not use that to promote 2.1 as complex and call it.

Feel free to discuss this further if you have questions.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-176-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 06:04:10 2003
Return-Path: <uhcosc1320-return-176-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LB495Z1251914
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 06:04:09 -0500 (CDT)
Received: (qmail 24300 invoked by uid 108); 21 Jul 2003 11:07:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21989 invoked from network); 21 Jul 2003 11:04:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211100.h6LB0MGt1242394@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 06:00:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] X obj=4; (fwd)
Status: O
X-UID: 172
Content-Length: 899
X-Keywords: $NotJunk                                                                                           

>(1)
>#include <iostream.h>
>class X
>{
>public:
>	X(int a){cout<<"X()"<<endl;}
>	X(const X& other){cout<<"X()"<<endl;}
>	~X(){cout<<"~X()"<<endl;}
>
>};
>
>void main()
>{
>	X obj=4;// ok
>}
>
>-----------------------------------------------
>(2)
>
>#include <iostream.h>
>class X
>{
>public:
>	X(){cout<<"X()"<<endl;}
>	X(const X& other){cout<<"X()"<<endl;}
>	~X(){cout<<"~X()"<<endl;}
>
>};
>
>void main()
>{
>	X obj=4;// error
>}
>----------------------------------------------
>
>Why do we have to have X(int a) to be OK ?

X obj = 4; is equivalent to 

X obj(4);

Since there is a constructor for X (in the first case) that takes an
int, it calls that. In the second case, there is not constructor
that takes an int and hence an error.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-177-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 06:06:13 2003
Return-Path: <uhcosc1320-return-177-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LB6D5Z1128053
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 06:06:13 -0500 (CDT)
Received: (qmail 25869 invoked by uid 108); 21 Jul 2003 11:10:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23346 invoked from network); 21 Jul 2003 11:06:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211102.h6LB2Rep1245411@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 06:02:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Subject: [uhcosc1320] Memory Allocation (fwd)
Status: O
X-UID: 173
Content-Length: 1942
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>	For the following code what does line 32 do, "Switch* pSwitch = new Switch;". Does it create a pointer on the stack called pSwitch, that points to the object Switch() created on the heap. If so wouldn't this cause memory leak because the deconstuctor does not delete the memory. If this is true then how would you delete the heap memory? 

You are correct. You would have to call delete pSwitch after line 33.

>Also in line 19 the position variable should be private.   

Yes.

>
>1 // Switch.h fileâ€™s contents:
>
>2 #include <iostream.h>
>
>3 class Switch {
>
>4 public:
>
>5          Switch()  { 
>
>6                      cout << "Switch::Switch()" << endl;
>
>7                      position = false; 
>
>8          }
>
>9          Switch(const Switch& other)    { 
>
>10                    cout << "Switch::Switch(const Switch& other)" << endl;
>
>11                    position = other.position; 
>
>12        }
>
>13        ~Switch() { 
>
>14                    cout << "Switch::~Switch()" << endl;
>
>15        }
>
>16        void turnOn() { position = true; }                                  Output:
>
>17        void turnOff() { position = false; }
>
>18        bool getPosition() { return position; }
>
>19        bool position;
>
>20 };
>
>21 // main.cpp fileâ€™s contents:
>
>22 #include <iostream.h>
>
>23 #include "Switch.h"
>
>24 void display(Switch sw) {
>
>25        bool result = sw.getPosition();
>
>26        cout << "Is Switch open?: " << result << endl;
>
>27 }
>
>28 void main() {
>
>29        Switch aSwitch;
>
>30        display(aSwitch);
>
>31        {
>
>32                    Switch* pSwitch = new Switch();
>
>33                    display(*pSwitch);
>
>34        }
>
>35        aSwitch.turnOn();
>
>36        display(aSwitch);
>
>37 }

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-178-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 06:06:24 2003
Return-Path: <uhcosc1320-return-178-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LB6N5Z1257448
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 06:06:23 -0500 (CDT)
Received: (qmail 26180 invoked by uid 108); 21 Jul 2003 11:10:16 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19219 invoked from network); 21 Jul 2003 11:01:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211057.h6LAv4Db1232047@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 05:57:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubts Regarding Assignment-1 (fwd)
Status: O
X-UID: 174
Content-Length: 1322
X-Keywords: $NotJunk                                                                                           

>Hello venkat,
> 
>First of all i am sorry for asking you a question on assignment-1.I have a doubt regarding getCounterLimit(limit) class sir.
> 
>Part of  my code in ModuloCounter.h file:
> 
>int getCounterLimit(int &counter_limit);

No need for the return type to be int here. You may write 

void getCounterLimit(int& counter_limit) const;

>Part of  my code in ModuloCounter.cpp file:
> 
>int ModuloCounter::getCounterLimit(int &counter_limit)
>{
> counter_limit = mod_limit_of_counter;
> 
> return counter_limit;
>}
> 
> 
>Is it ok if i return an 'int' for this function sir or do i need to put 'void' and not return anything.If both ways are ok then which one is more efficient.Could you please clarify.
> 
>Thanks and Regards.

Since the value is being set by reference, no need to return any thing.
Ideally, I would not pass the argument by reference. I would only 
return. However, in this assignment, I wanted you to understand the
usage of reference, so I wrote it in a way that you would typically not.

In general I would have

int getCounterLimit() const;

For this assignment, however, I would have

void getCounterLimit(int& counter_limit) const;

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-179-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 06:15:41 2003
Return-Path: <uhcosc1320-return-179-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LBFe5Z1280296
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 06:15:40 -0500 (CDT)
Received: (qmail 32594 invoked by uid 108); 21 Jul 2003 11:19:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12951 invoked from network); 21 Jul 2003 10:51:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211047.h6LAlaFn1210097@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 05:47:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Singleton class - DBManager (fwd)
Status: O
X-UID: 175
Content-Length: 610
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>In the DBManager class we wrote,
>
>static DBManager* dbMgr and if(dbMgr == 0) to make sure we create only one 
>object.
>
>Why can't we have a static variable count and check if count is zero and 
>then only create the object? Wouldn't that also ensure that we are creating 
>a single instance of the class?
>
>Thanks,

No. I gave a better solution in class than the one in slides.
Please refer to that (Example from class on July 15th). 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-180-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 13:32:51 2003
Return-Path: <uhcosc1320-return-180-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LIWp5Z1327004
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 13:32:51 -0500 (CDT)
Received: (qmail 19392 invoked by uid 108); 21 Jul 2003 18:36:46 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18452 invoked from network); 21 Jul 2003 18:35:48 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211831.h6LIVlIp1327075@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 13:31:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Another new "Const" Ques. (fwd)
Status: O
X-UID: 176
Content-Length: 2440
X-Keywords: $NotJunk                                                                                           

>Hello Venkat
> 
>I have another problem with 'CONST'.
>Given following two different codes:
>////////////////////////////////////////////
>#include <iostream>
>//#include "Sample.h"
>using namespace std;
>class Sample
>{
>public:
> Sample()
> {
>  val = 2;
> // p = &val;
> }
> //const int * getVal() const /*****************************
>    int * getVal() const
> {
>  return &val;
>     //return p;
> }
>private:
> int val;
> //int *p;
>};
> 
>void main()
>{
>  Sample obj;
>  int * p = obj.getVal();
>  cout << *p << endl;
> //*p = 7;
> cout << *(obj.getVal()) << endl;
>}
> 
> 
>////////////////////////////////////////////////////////
> 
>#include <iostream>
>using namespace std;
>class String
>{
>public:
> String(const char*pVal)
> {
> pRealString = 0;
> setString(pVal);
> }
>
> String(const String& other)
> {
>  pRealString = 0;
>  setString(other.pRealString);
> }
> void setString(const char* pVal)
> {
>  delete[]pRealString;
>  pRealString = new char[(strlen(pVal) + 1)];
>  strcpy(pRealString,pVal);
> }
>   char* getString() const/*******************************
>  {
>   return pRealString;
>  }
>private:
> char * pRealString;
>};
>void main()
>{
> String str1 = "Hello";
> //String str2 = str1;
>  char* str2 = str1.getString();/***********************************/
> cout << str1.getString() <<endl;
> str1.setString("Hi");
> cout<<str1.getString()<<endl;
>// cout<<str2.getString()<<endl;
> cout<<str2<<endl;
>}  
> 
>In /******************** lines of above two codes
>In first code,if I donot write const on leftmost of the getVal funtion,compiler cries and says
> 
>c:\gouri\sample\sample.h(13) : error C2440: 'return' : cannot convert from 'const int *' to 'int *'
>        Conversion loses qualifiers
>Error executing cl.exe.
> 
> 
> 
>But it compiles fine,even without this leftmost const for the quite similar second code.
>Why??
>In both codes,get funtion is returning  member variables and this variable is being assigned to outside variables.
> 
>Thanks for answering our questions, its really very helpful.


In the first case  you are getting a pointer to the data that is within,
what the compiler thinks, is the bounds of the object. In the second case
you are getting a pointer to what the compiler thinks is outside the
bounds of the object.
 
Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-181-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 13:41:11 2003
Return-Path: <uhcosc1320-return-181-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LIfB5Z1350851
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 13:41:11 -0500 (CDT)
Received: (qmail 28052 invoked by uid 108); 21 Jul 2003 18:45:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20973 invoked from network); 21 Jul 2003 18:38:06 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211834.h6LIY5iR1330332@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 13:34:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] inline in Midterm 1 (fwd)
Status: O
X-UID: 177
Content-Length: 362
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Will inline be covered on the exam??
>

Answer is no.

Please use an appropriate subject line for your messages. For example,
you could write "inline in midterm 1" instead of Exam as subject.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-182-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 13:41:31 2003
Return-Path: <uhcosc1320-return-182-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LIfS5Z1348866
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 13:41:28 -0500 (CDT)
Received: (qmail 28530 invoked by uid 108); 21 Jul 2003 18:45:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23466 invoked from network); 21 Jul 2003 18:40:29 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211836.h6LIaTdm1335086@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 13:36:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Software Extensibility (fwd)
Status: O
X-UID: 178
Content-Length: 537
X-Keywords: $NotJunk                                                                                           

>How is it that Inheritance and Polymorphism are
>concepts in OO that facilitate extensiblity.  I thought it was classes and objects because you can add classes and objects without changing exsisting code.  

You can add a new class, but how will the new class be used in the
system? It is polymorphism that makes this happen. Stay tuned and
we will get to this next week or so.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-183-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 13:42:02 2003
Return-Path: <uhcosc1320-return-183-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LIg25Z1351691
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 13:42:02 -0500 (CDT)
Received: (qmail 29203 invoked by uid 108); 21 Jul 2003 18:45:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21554 invoked from network); 21 Jul 2003 18:38:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211834.h6LIYYW11334968@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 13:34:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Is UML on Midterm 1 (fwd)
Status: O
X-UID: 179
Content-Length: 271
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>Is any of UML covered on the first test.

No.

(And thanks for using appropriate subject line).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-184-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 13:47:07 2003
Return-Path: <uhcosc1320-return-184-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LIl75Z1362921
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 13:47:07 -0500 (CDT)
Received: (qmail 2029 invoked by uid 108); 21 Jul 2003 18:50:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24444 invoked from network); 21 Jul 2003 18:41:29 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211837.h6LIbRo71337546@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 13:37:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] summer 2002 #3 and #4 (fwd)
Status: O
X-UID: 180
Content-Length: 402
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>I am checking my answers on the sample exams.  Could you give the =
>answers to questions 3 and 4 on the Summer 2002 exam 1?  Thank you!

I will be glad to review your answer and comment on it. I do not post
answers though. Sorry.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-185-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 13:48:15 2003
Return-Path: <uhcosc1320-return-185-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LImF5Z1369312
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 13:48:15 -0500 (CDT)
Received: (qmail 3287 invoked by uid 108); 21 Jul 2003 18:52:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22609 invoked from network); 21 Jul 2003 18:39:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211835.h6LIZbnv1337805@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 13:35:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Person Program (fwd)
Status: O
X-UID: 181
Content-Length: 3382
X-Keywords: $NotJunk                                                                                           

>So every time I step of the block (}), then the object
>is destroyed (~person() is called), and does the
>compiler will automatically recognize this?
>
>Thanks Venkat


Wait, every time you step over }, any object created on the stack
within that block is destroyed and that is done automatically 
by the compiler.

Venkat

>--- "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>wrote:
>> >Hello Svenkat,
>> 
>> Misspelling my name does not offend me. However,
>> generally before I 
>> send an email, I try to verify the name of the
>> person, especially if
>> the name is some thing I am not familiar with. This
>> goes a long way
>> in professional relationships. Every email I send
>> has my name in it.
>> It should take you little effort to get it correct!
>> 
>> >Please look at the code here
>> >
>> >
>> >#include <iostream.h>
>> >
>> >class Person
>> >{
>> >public:
>> >	Person() {numberOfPersons++;}
>> >	~Person(){numberOfPersons--;}
>> >	static int getNumberOfPersons() {return
>> >numberOfPersons;}
>> >private:
>> >	static int numberOfPersons;
>> >
>> >};
>> >
>> >int Person::numberOfPersons = 0;
>> >
>> >void	main()
>> >{
>> >	cout<<Person::getNumberOfPersons() << endl;
>> >	Person p1;
>> >	cout <<Person::getNumberOfPersons() << endl;
>> >	Person p2;
>> >	cout <<Person::getNumberOfPersons() << endl;
>> >	{
>> >		Person p3;
>> >		cout <<Person::getNumberOfPersons() << endl;
>> >	}
>> >1)	cout <<Person::getNumberOfPersons() << endl;
>> >	{
>> >		Person p4;
>> >2)		cout <<Person::getNumberOfPersons() << endl;
>> >	}
>> >3)	cout <<Person::getNumberOfPersons() << endl;
>> >}
>> >
>> >
>> >Here is my question
>> >In line 1) ( as i marked) the output is 2 why?  how
>> >they know to call ~person(){NumberOfPerson--}?
>> 
>> Right before line 1, in the inner block Person p3
>> was created and destroyed. 
>> When you stepped out of the inner block, p3 was
>> destroyed and its
>> destructor was called automatically.
>> 
>> >In line 2)  the output is 3 why?
>> 
>> At this point, the following objects are alive: p1,
>> p2 and p4.
>> 
>> >In line 3)  the output is 2 why?
>> 
>> At this point, the following objects are alive: p1,
>> p2. p4 is dead on
>> stepping out of the } before line 3.
>> 
>> >I don't know why these output like that why they
>> call
>> >Person() and when they call ~Person().
>> >
>> >If i want to have output like this:
>> >0
>> >1
>> >2
>> >3
>> >2
>> >1 
>> >how i write the code for it?
>> >
>> >Thanks
>> 
>> If you want to above mentioned output, you can write
>> 
>> void main()
>> {
>> 	cout <<Person::getNumberOfPersons() << endl;
>> 	Person p1;
>> 	cout <<Person::getNumberOfPersons() << endl;
>> 	{
>> 		Person p2;
>> 		cout <<Person::getNumberOfPersons() << endl;
>> 		{
>> 			Person p3;
>> 			cout <<Person::getNumberOfPersons() << endl;
>> 		}
>> 		cout <<Person::getNumberOfPersons() << endl;
>> 	}
>> 	cout <<Person::getNumberOfPersons() << endl;
>> }
>> 
>> 
>> Venkat Subramaniam
>> --				
>> cosc155g@bayou.uh.edu		Department of Computer
>> Science
>> http://www.cs.uh.edu/~svenkat 	University of
>> Houston, Houston, Tx 77204-3475
>
>
>__________________________________
>Do you Yahoo!?
>SBC Yahoo! DSL - Now only $29.95 per month!
>http://sbc.yahoo.com
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-186-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 13:49:58 2003
Return-Path: <uhcosc1320-return-186-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LInv5Z1342941
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 13:49:57 -0500 (CDT)
Received: (qmail 5143 invoked by uid 108); 21 Jul 2003 18:53:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27350 invoked from network); 21 Jul 2003 18:44:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211840.h6LIeJm01348340@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 13:40:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question on & and value (fwd)
Status: O
X-UID: 182
Content-Length: 1190
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I was wodnering if what I think is correct for the differences between these two lines.
>
>void function1 (X obj) 
>void function2 (X& obj) 
>
>The implications of these two lines is that line one is pass by value and a deep copy is made and the copy constructor and destructor is invoked.  This involves overhead which is unessessary.
>

What you have said above is almost correct. In fact all except one word is
correct - deep. Whether the copy is deep or shallow depends on whether you
wrote the copy constructor or you are relying on the provided one. Every thing
else you have said is great.

>The second line is pass by reference and the copy constructor is not invoked so there is no overhead.

Correct, but I think the comparison above is wrong. I would say 
void function2(const X& obj) because one advantage you get from
call by value is the object is not modified. The const references 
guarantees that the object will not be modified and at the same time
it eliminates the overhead you have discussed above.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-187-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 13:54:57 2003
Return-Path: <uhcosc1320-return-187-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LIsv5Z1380343
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 13:54:57 -0500 (CDT)
Received: (qmail 10370 invoked by uid 108); 21 Jul 2003 18:58:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8438 invoked from network); 21 Jul 2003 18:56:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211852.h6LIqmK31377872@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 13:52:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Old Exam...Copy Constructor... (fwd)
Status: O
X-UID: 183
Content-Length: 1385
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>In Summer 2001 Midterm 1 Exam, problem 9.
>
>9.   Given the following code [4 pts]:
>
>class Car
>
>{
>
>            Engine* pEngine;
>
>public:
>
>            Car() { pEngine = new Engine(); }
>
>            ~Car() { delete pEngine; }
>
>};
>
> 
>
>void main()
>
>{
>
>            Car myCar1;
>
>            Car myCar2 = myCar1;
>
>}
>
> 
>
>What is the default behavior of C++ when it encounters the statement 
>
>Car myCar2 = myCar1;
>
>My answer: The default copy constructor will make a shallow copy of myCar1. 

I would also add that as a result both myCar2 and myCar1 will end up
sharing the engine which is not good.
> 
>
>Why is this default behavior not good for all cases? How would you solve it?
>
>My answer: Write a copy constructor that will make a deep copy of myCar1.
>
>For the first part I'm having trouble putting it into words. I guess I would say that it is not good for cases that have two objects of the same class within different scopes of the program.

No, the answer is, it is not good because, you would want to have your
own copy of what you aggregate like Engine and not share with another object.
>
>I'm not sure if that's right...your input would be greatly appreciated.
>
>Thanks

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-188-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 14:04:35 2003
Return-Path: <uhcosc1320-return-188-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6LJ4Z5Z1407337
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 14:04:35 -0500 (CDT)
Received: (qmail 20581 invoked by uid 108); 21 Jul 2003 19:08:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19145 invoked from network); 21 Jul 2003 19:07:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307211903.h6LJ303r1406648@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 14:03:00 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Subject: [uhcosc1320] Calling Destructor...Old exam... (fwd)
Status: O
X-UID: 184
Content-Length: 1825
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>On Summer 2002, Midterm 1, problem 5...
>
>5.      Write the output of the code given below[7 pts]:
>
>1 // Switch.h file’s contents:
>
>2 #include <iostream.h>
>
>3 class Switch {
>
>4 public:
>
>5          Switch()  { 
>
>6                      cout << "Switch::Switch()" << endl;
>
>7                      position = false; 
>
>8          }
>
>9          Switch(const Switch& other)    { 
>
>10                    cout << "Switch::Switch(const Switch& other)" << endl;
>
>11                    position = other.position; 
>
>12        }
>
>13        ~Switch() { 
>
>14                    cout << "Switch::~Switch()" << endl;
>
>15        }
>
>16        void turnOn() { position = true; }                                  Output:
>
>17        void turnOff() { position = false; }
>
>18        bool getPosition() { return position; }
>
>19        bool position;
>
>20 };
>
>21 // main.cpp file’s contents:
>
>22 #include <iostream.h>
>
>23 #include "Switch.h"
>
>24 void display(Switch sw) {
>
>25        bool result = sw.getPosition();
>
>26        cout << "Is Switch open?: " << result << endl;
>
>27 }
>
>28 void main() {
>
>29        Switch aSwitch;
>
>30        display(aSwitch);
>
>31        {
>
>32                    Switch* pSwitch = new Switch();
>
>33                    display(*pSwitch);
>
>34        }
>
>35        aSwitch.turnOn();
>
>36        display(aSwitch);
>
>37 }
>
>
>...on line 34, why was the destructor not called when it stepped out of that inner scope?
>
>Thanks

This was part of the following question in which students were 
asked to identify problem with the code. This was one of the
things they were expected to write.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-189-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 21:31:28 2003
Return-Path: <uhcosc1320-return-189-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6M2VR5Z1472131
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 21:31:27 -0500 (CDT)
Received: (qmail 7069 invoked by uid 108); 22 Jul 2003 02:35:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6381 invoked from network); 22 Jul 2003 02:34:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307220230.h6M2URQm1468885@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 21:30:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] << overloading in Assignment2 (fwd)
Status: O
X-UID: 185
Content-Length: 609
X-Keywords: $NotJunk                                                                                           

>I have this syntax in public and its giving me an error
>
>error C2143: syntax error : missing ';' before '&'
>error C2501: 'String::ostream' : missing storage-class or type
>specifiers
>
>for 
>
>... deleted...
>
>I have checked the syntax and im not sure what is exactly wrong.
>Intellisense shows it is std::ostream and iostream is included. Thanks

Make sure that in your String.h file, you have #include <iostream>
and the using namespace std.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-190-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 21:34:40 2003
Return-Path: <uhcosc1320-return-190-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6M2Yd5Z1482105
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 21:34:39 -0500 (CDT)
Received: (qmail 9527 invoked by uid 108); 22 Jul 2003 02:38:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7541 invoked from network); 22 Jul 2003 02:36:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307220231.h6M2Vv5I1361202@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 21:31:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] homework 2 (fwd)
Status: O
X-UID: 186
Content-Length: 268
X-Keywords: $NotJunk                                                                                           

>Can you tell me if we have gone over the material needed to be able to do homework 2?  Thanks.

Yes we have!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-191-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 22:22:45 2003
Return-Path: <uhcosc1320-return-191-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6M3Mj5Z1076805
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 22:22:45 -0500 (CDT)
Received: (qmail 10648 invoked by uid 108); 22 Jul 2003 03:26:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6878 invoked from network); 22 Jul 2003 02:35:08 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307220231.h6M2V5OM1472059@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 21:31:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] string declarations (fwd)
Status: O
X-UID: 187
Content-Length: 259
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>Is there a difference between String str1 = "Hello" and String =
>str1("Hello")?

Nope.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-192-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 21 23:58:28 2003
Return-Path: <uhcosc1320-return-192-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6M4wR5Z1315494
	for <cosc155g@bayou.uh.edu>; Mon, 21 Jul 2003 23:58:27 -0500 (CDT)
Received: (qmail 6719 invoked by uid 108); 22 Jul 2003 05:02:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 822 invoked from network); 22 Jul 2003 04:52:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307220448.h6M4msl61284529@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 23:48:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] notification of grades. (fwd)
Status: O
X-UID: 188
Content-Length: 751
X-Keywords: $NotJunk                                                                                           

>I'm not sure if you've mentioned this previously, but how will we find out
>our grades on the homework, assignments, and tests?
> 
>Thanks.

Here is my response to a related email a couple of days ago.

While I spend significant amount of time replying to technical questions
over email, I do not encourage points, grades or score related questions.
If you have questions related to grades or points, please talk to me
during my office hours.

Sorry, I am a bit adamant about this one. Experience shows that this
issue is of no benefit to me, and of no long term benefit to students 
either.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-193-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 22 00:00:41 2003
Return-Path: <uhcosc1320-return-193-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6M50f5Z1323041
	for <cosc155g@bayou.uh.edu>; Tue, 22 Jul 2003 00:00:41 -0500 (CDT)
Received: (qmail 8352 invoked by uid 108); 22 Jul 2003 05:04:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29767 invoked from network); 22 Jul 2003 04:47:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307220443.h6M4h7i01124165@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 23:43:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] HW2 (fwd)
Status: O
X-UID: 189
Content-Length: 356
X-Keywords: $NotJunk                                                                                           

>Venkat,
>In the HW2, do we have to answer both question #2 and
>#3, or just choose the one it should have.
>
>Thanks

We will have enough to fill in all the questions on it!
(ok, lets hope we do).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-194-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 22 00:03:09 2003
Return-Path: <uhcosc1320-return-194-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6M5395Z1326867
	for <cosc155g@bayou.uh.edu>; Tue, 22 Jul 2003 00:03:09 -0500 (CDT)
Received: (qmail 10092 invoked by uid 108); 22 Jul 2003 05:07:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31241 invoked from network); 22 Jul 2003 04:49:40 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307220445.h6M4jbZ41286340@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 23:45:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] linker error in << overloading in Assignment2 (fwd)
Status: O
X-UID: 190
Content-Length: 1031
X-Keywords: $NotJunk                                                                                           

>I finally added namespace. Apparently even if you add it in the cpp
>file, it still shouts until you add namespace in the .h ... in any case,
>I now have a linker error I don't even understand.

Well that is a progress. Let's see what up with this one.

>... code deleted...
>error LNK2005: "class std::basic_ostream<char,struct
>std::char_traits<char> > & __cdecl operator<<(class
>std::basic_ostream<char,struct std::char_traits<char> > &,class String
>&)"
>(??6@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AAV01@AAVString@@
>@Z) already defined in assign2.obj
>
>
>fatal error LNK1169: one or more multiply defined symbols found
>
>... code deleted...
>thanks for your time.
>

This is a symptom of the putting the implementation in the header disease.
Move the implementation to the .cpp file (while leaving the declaration
in the header) and it should go away.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-195-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 22 00:05:44 2003
Return-Path: <uhcosc1320-return-195-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6M55h5Z1336294
	for <cosc155g@bayou.uh.edu>; Tue, 22 Jul 2003 00:05:44 -0500 (CDT)
Received: (qmail 11873 invoked by uid 108); 22 Jul 2003 05:09:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29319 invoked from network); 22 Jul 2003 04:46:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307220442.h6M4gRJ01277275@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 21 Jul 2003 23:42:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] question on homework 2 (fwd)
Status: O
X-UID: 191
Content-Length: 722
X-Keywords: $NotJunk                                                                                           

>I don't quite understand what is being asked on homework 2 for question 2 and 3.  Are you able to rephrase the questions, please?  Thanks.

Alright. Let's take this in steps. Go ahead and implement the code.
See which of those members (of the class) will require you to use
the initialization list. See which ones will require initialization 
in the constructor. Also think about which ones give you the
option of either way. Then explain why each one is behaving the way
it is and for those which gave you the option, explain why you opted one
way or the other.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-196-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 22 05:40:21 2003
Return-Path: <uhcosc1320-return-196-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6MAeK5Z1106814
	for <cosc155g@bayou.uh.edu>; Tue, 22 Jul 2003 05:40:20 -0500 (CDT)
Received: (qmail 25612 invoked by uid 108); 22 Jul 2003 10:44:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24823 invoked from network); 22 Jul 2003 10:42:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307221038.h6MAcqX31106198@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 22 Jul 2003 05:38:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question 2 and 3 in homework 2 (fwd)
Status: O
X-UID: 192
Content-Length: 1196
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>Could you please explain to me a little bit about question 2 and 3 in =
>hw2.
>
>Question1: I can write a constructor as following to initialize class =
>Person (already compiled)
>
>... deleted...
>
>Question 2: I can explain why I did in question 1
>
>Question 3: Because I already use all members in class Person in the =
>initialization list, there is nothing left for me to put outside =
>initialization list. So what is this question about?

So, in all the examples you have seen so far and we have written so far,
did we put every thing in the initialization list? We did not. We chose
to put them in the body of the constructor if we can, didn't we.

>I am confused. I can do another way. ... deleted...
>... code deleted...
>Which ways are better?
>
>Thanks

In class we discussed a few details as to the advantages of one over the other.
What this HW says is for you to express your opinion on what you think is better.
So, think about reasons why you would put stuff in one place or the other and
write that up.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-197-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 22 05:44:04 2003
Return-Path: <uhcosc1320-return-197-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6MAi35Z1113859
	for <cosc155g@bayou.uh.edu>; Tue, 22 Jul 2003 05:44:04 -0500 (CDT)
Received: (qmail 28194 invoked by uid 108); 22 Jul 2003 10:47:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25502 invoked from network); 22 Jul 2003 10:44:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307221039.h6MAdwL51105174@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 22 Jul 2003 05:39:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] question on homework 2 (fwd)
Status: O
X-UID: 193
Content-Length: 585
X-Keywords: $NotJunk                                                                                           

>Venkat,
>As you said below, how we can know if which ones give
>us options of both ways.  As i think, when we
>implement the code, only one option is visible that is
>if it need initialization or not.  I don't know if my
>thinking is right, b/c i haven't tried to implement it
>yet.  But if you have a way to recognize this, please
>share with us.
>
>Thanks

Go ahead and implement it. This will help you figure out 
further.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-198-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 05:38:47 2003
Return-Path: <uhcosc1320-return-198-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NAck5Z1487592
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 05:38:47 -0500 (CDT)
Received: (qmail 32340 invoked by uid 108); 23 Jul 2003 10:42:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31852 invoked from network); 23 Jul 2003 10:42:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231038.h6NAc2rB1523230@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 05:38:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] question on homework 2 (fwd)
Status: O
X-UID: 194
Content-Length: 872
X-Keywords: $NotJunk                                                                                           

>I try to implement the code like you suggested and I keep getting an error stating that 'String' and 'Brain' have no appropriate default constructor available.  What I then tried was to create an empty Person constructor and it gave me an error stating that birthdate must be initialized in the constructor base/member initializer list along with the errors above.  Is it okay that 'String' and 'Brain' have no default constructor?  And is the method which I did correct, as far as having an empty Person constructor being ok?  Thanks.

You may want to refer to the example titled AggregationByValue in
which I showed how a Building would use Elevators where the
Elevator class did not have an empty constructor.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-199-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 05:47:06 2003
Return-Path: <uhcosc1320-return-199-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NAl65Z1550238
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 05:47:06 -0500 (CDT)
Received: (qmail 5465 invoked by uid 108); 23 Jul 2003 10:51:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3259 invoked from network); 23 Jul 2003 10:47:45 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231043.h6NAhVra1442198@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 05:43:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] please post midterm1 to past exams list (fwd)
Status: O
X-UID: 195
Content-Length: 285
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>Can you please post midterm1 (for summer 2003) to the
>past exams list.
>
>Thank you 

Sure. It's there now.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-200-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 05:47:11 2003
Return-Path: <uhcosc1320-return-200-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NAlA5Z1550688
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 05:47:11 -0500 (CDT)
Received: (qmail 5635 invoked by uid 108); 23 Jul 2003 10:51:09 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5197 invoked from network); 23 Jul 2003 10:50:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231046.h6NAkN341546171@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 05:46:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Can you send the examples from today's class and Yesterday? (fwd)
Status: O
X-UID: 196
Content-Length: 661
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>Could you please send out the examples from yesterday's(7/21/03) and
>today's(7/23) class?
>
>Thank you.

Those from the review session on Saturday (07/19) is posted already
at http://www.cs.uh.edu/~svenkat/summer2003/ExamplesFromClass/

There is none from 7/21 since we had exam that day.
After each class I post that day's examples at the same location.
(Unless I get carried away with discussions and I forget - like
I did on 7/22 - it will be posted the following day, hopefully).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-201-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 06:01:48 2003
Return-Path: <uhcosc1320-return-201-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NB1m5Z1053678
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 06:01:48 -0500 (CDT)
Received: (qmail 16569 invoked by uid 108); 23 Jul 2003 11:05:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15997 invoked from network); 23 Jul 2003 11:05:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231100.h6NB0qNk1059852@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 06:00:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] compiler error message on "new" (fwd)
Status: O
X-UID: 197
Content-Length: 575
X-Keywords: $NotJunk                                                                                           

>Hi, I was playing around with some code and came across this error when
>I accidently forgot to declare tmp a pointer:
>
>Class X { .. }
>
>X tmp = new X;
>
>The error comes up as "conversion from 'X*' to non-scalar type X'
>requested." 
>
>What does the compiler mean by "non-scalar" in this example? Thanks

I think what they mean by non-scalar here is user-defined type 
(or non-built-in or non-primitive type)..

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-202-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 06:07:32 2003
Return-Path: <uhcosc1320-return-202-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NB7W5Z1073032
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 06:07:32 -0500 (CDT)
Received: (qmail 20804 invoked by uid 108); 23 Jul 2003 11:11:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17672 invoked from network); 23 Jul 2003 11:07:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231103.h6NB33wI1062764@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 06:03:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] homework 2 (fwd)
Status: O
X-UID: 198
Content-Length: 414
X-Keywords: $NotJunk                                                                                           

>When we compile the code given on the homework, is it suppose to give us a linking error?  If so, what can we do to get rid of this error?  Thanks.

If you get a link error, you will have to provide implementation for
the methods it is complaining about.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-203-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 06:10:54 2003
Return-Path: <uhcosc1320-return-203-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NBAr5Z1083399
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 06:10:53 -0500 (CDT)
Received: (qmail 23156 invoked by uid 108); 23 Jul 2003 11:14:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19296 invoked from network); 23 Jul 2003 11:09:17 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231105.h6NB57nc1070434@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 06:05:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] location of istream >> overload (fwd)
Status: O
X-UID: 199
Content-Length: 1176
X-Keywords: $NotJunk                                                                                           

>Venkat,
>I'm trying to overload the istream >> operator for assignment 2.  If I make
>it a global function in String.cpp, the compiler can't "find it" when trying
>to compile assign2.cpp(err = C2679).  When I try to move the function into
>String.h so that it will be available during compilation, that solves that
>problem.  It creates a new one however.  String.cpp and assign2.cpp both
>include String.h so the linker sees the function twice and complains about
>that(err = LNK2005).  I could put the definition in assign2.cpp or in a
>separate .h and only #include that in assign2.cpp.  Both of those solutions,
>however, violate the mandate in assign2.cpp to not modify that file.  I
>could use the linker option /FORCE to override the linker problem I think,
>but I'm not sure that's the right thing here.  Any advice?
> 
>P.S.  This obviously applies to ostream << as well.

As a general rule, declare the global functions in the .h and 
implement it in the .cpp. In this case, I would declare it in
String.h and implement it in String.cpp.

Take a look at how I have declared and implemented the global 
operator- in the overloading example of Complex class.

Venkat

From uhcosc1320-return-204-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 06:11:17 2003
Return-Path: <uhcosc1320-return-204-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NBBH5Z1085121
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 06:11:17 -0500 (CDT)
Received: (qmail 23546 invoked by uid 108); 23 Jul 2003 11:15:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17088 invoked from network); 23 Jul 2003 11:06:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231102.h6NB2AVN1062252@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 06:02:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] HMWK 2- question 2 & 3 (fwd)
Status: O
X-UID: 200
Content-Length: 592
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>I was wondering if you could explain a little more about initialization lists and how you decide what goes in it and what does not.  I am very confused.  I tried to find the example you did in class but I cannot find it.
>
>Thank You 

Try looking at the AggregationByValue example of Building and Elevator.
If you still can't understand, bring up this question in class today
and we will discuss some of the details.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-206-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 06:16:36 2003
Return-Path: <uhcosc1320-return-206-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NBGa5Z1089750
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 06:16:36 -0500 (CDT)
Received: (qmail 27639 invoked by uid 108); 23 Jul 2003 11:20:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20158 invoked from network); 23 Jul 2003 11:10:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231106.h6NB6KDJ1070548@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 06:06:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question 1 Homework number 2 (fwd)
Status: O
X-UID: 201
Content-Length: 432
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>When you say to implement the constructor of Person, should I include
>the initialization list that I would use? 
> 
>Thanks 

What I mean is write the code and play with it and you will know
what you need where (in the initialization list or within the body).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-205-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 06:16:38 2003
Return-Path: <uhcosc1320-return-205-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NBGc5Z1099654
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 06:16:38 -0500 (CDT)
Received: (qmail 27592 invoked by uid 108); 23 Jul 2003 11:20:35 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25864 invoked from network); 23 Jul 2003 11:18:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231114.h6NBESsH1087710@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 06:14:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubt regarding member vs global usage of operator overloaded funtions (fwd)
Status: O
X-UID: 202
Content-Length: 1748
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>     I have few doubts regarding member and global functions for operator overloading. Though you have explained the follwing things,i realized that i did not understand certain things properly.
>
>A.  Why should member functions be preferred over global functions in case of operator overloading?
>-- My understanding is: 
>1.  Since member functions are available within the class and since private variables cannot be accessed by global functions, the member funtions should be preferred for operator overloading.
>

Yes, and also, in a OO sense, you want to make it object-oriented rather
than procedural.

>B. While deciding member or global for operator overloaded functions,does operators or operands have the say?
>-- My understanding is: 
>1. Deciding between member and global for operator overloaded functions depends on the operands and not operators.
>

Actually, it is the type of the operand on the left that helps us with the 
decision. (except in the case of unary operators like ++obj in which case
the one and only operand helps us make the decision).

>C. Operator= has to be member and not  global.Why is it so? 
> 
>Could you please clarify my doubts.I think my doubts are reasonably big.Sorry for that.
>
>Thanks and Regards.

Operator= is copying one object to another. Copying involves setting the
state of one object to an equivalent state of another. This involves
dealing directly with the guts or internals of an object. You can not
achieve this from outside the object (from a global function that is)
using the public interface of the object.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-207-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 06:16:58 2003
Return-Path: <uhcosc1320-return-207-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NBGv5Z1100782
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 06:16:57 -0500 (CDT)
Received: (qmail 28125 invoked by uid 108); 23 Jul 2003 11:20:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23363 invoked from network); 23 Jul 2003 11:15:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231110.h6NBAtjE1085150@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 06:10:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] constructor and assigning (fwd)
Status: O
X-UID: 203
Content-Length: 1791
X-Keywords: $NotJunk                                                                                           

><DIV>Hi Venkat</DIV>
><DIV>&nbsp;</DIV>
><DIV>I have a question I remember today in class you were distinguishing between assigning and initializing. You said when we say X b=4, where X is a class and has a private member of type int. Lets say we have a constructor in X, not the default one </DIV>
><DIV>&nbsp;</DIV>
><DIV>class X{</DIV>
><DIV>&nbsp; public: </DIV>
><DIV>&nbsp;&nbsp;&nbsp; X(int a);</DIV>
><DIV>&nbsp; private:</DIV>
><DIV>&nbsp;&nbsp;&nbsp; int v;</DIV>
><DIV>};</DIV>
><DIV>X::X(int a)</DIV>
><DIV>{</DIV>
><DIV>&nbsp; v=a;</DIV>
><DIV>}</DIV>
><DIV>&nbsp;</DIV>
><DIV>in this case v=a is assigning. So why were you saying that X b=4 is initializing. Is is because it is initializing for the object b but assinging for the private member variable v. </DIV>

Yes.

><DIV>I hope I am on the right track. </DIV>
><DIV>Thanks</DIV>

Now, b is being created. When b is created the constructor is called.
However, by the time you enter the body of the constructor, the
guts of the object being created have been initialized and you 
assign values to these variables within the constructor body.
If you truly want to initialize the guts and not assign to it,
you would have to use the initlization list.

You have
class X
{
public:
	X(int a);
private:
	int v;
};

X::X(int a)
{
	v = a;
}

Above v is assigned to.

However, if I write

X::X(int a) : v(a)
{
}

Here v is initialized.

Again go back to the Building and Elevator example and see if it 
makes sense. I explained in length why Elevator's constructor
has to be given data in the initilization list and not within the
body of the constructor of the Building.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-208-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 12:54:33 2003
Return-Path: <uhcosc1320-return-208-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NHsW5Z1571776
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 12:54:32 -0500 (CDT)
Received: (qmail 30095 invoked by uid 108); 23 Jul 2003 17:58:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12266 invoked from network); 23 Jul 2003 17:43:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231730.h6NHU9R4698792@creek.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 12:30:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] complex example (fwd)
Status: O
X-UID: 204
Content-Length: 723
X-Keywords: $NotJunk                                                                                           

>Can you explain why you had an implementation for   
>Complex operator-(const Complex& operand1, 
>				  const Complex& operand2);
>
>but not for 
>Complex operator+(const double& val, const Complex& operand2);
>
>Thanks.

I just did not get around to implementing it. That's all.
If my operator+ were global and I have a constructor to Complex
that can take an int, I do not have to write (no declaration and
no implementation) operator+ on double and Complex. If I do not 
have those two, then I would declare and implement the operator+
for double and Complex.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-209-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 13:42:12 2003
Return-Path: <uhcosc1320-return-209-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NIgB5Z1162843
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 13:42:12 -0500 (CDT)
Received: (qmail 19302 invoked by uid 108); 23 Jul 2003 18:46:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27491 invoked from network); 23 Jul 2003 17:28:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231723.h6NHNjf8698707@creek.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 12:23:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Building/Elevator example (fwd)
Status: O
X-UID: 205
Content-Length: 616
X-Keywords: $NotJunk                                                                                           

>I was looking at the Building/Elevator problem and I couldn't recall why you placed "e2(floors, 1), e1(floors, 0)" in the initializer list.  I know it has to do with after we enter the {} brackets but not exactly sure why.  Can you please explain once more.  Thanks.
>

I just sent out an email that speaks about this with another example.
Please read that and see if that helps. Also compile and run the 
program I have sent as part of that email as well.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-210-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 23 13:42:50 2003
Return-Path: <uhcosc1320-return-210-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6NIgo5Z1164206
	for <cosc155g@bayou.uh.edu>; Wed, 23 Jul 2003 13:42:50 -0500 (CDT)
Received: (qmail 20247 invoked by uid 108); 23 Jul 2003 18:46:55 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27500 invoked from network); 23 Jul 2003 17:28:52 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231722.h6NHMdeW698696@creek.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 12:22:39 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problems understanding Initializing list (fwd)
Status: O
X-UID: 206
Content-Length: 1798
X-Keywords: $NotJunk                                                                                           

>I'm still having trouble understanding when to use an initializing list and what exactly it's doing.  I've looked at your examples but I'm not clear.  Could you please explain.  Sorry, I know you already discussed this.
>

When an object of a class is created, its internals (guts) are created
first. Then the constructor's body is called. 

Consider the class

class A
{
private:
	int v1;
	int v2;
public: 
	A() : v1(4)
	{
		// by the time the run time gets here, the guts of A has
		// been created. Here is variable v1 has been initialized
		// (already constructed) to a value of 4. The variable v2
		// has been initialized to what ever garbage was at that
		// memory location. In other words, both v1 and v2 have
		// been created.

		v2 = 5; // You are not initizlizing v2 here. You are simply
			// assignning to it now.
	}	
};

In the A() : v1(4), you are telling the compiler (or run time) to 
initialize v1 to 4 and initialize v2 to what ever the default is,
and in C++, the default is to leave what ever is at that memory location.

Now consider the following example (Go ahead and execute this,
step through the code to understand it):

// Save this to main.cpp and compile and run
#include <iostream>
using namespace std;

class B
{
public:
	B()
	{
		cout << "In B()" << endl;
	}

	B(int a)
	{
		cout << "In B(int a) with " << a << endl;
	}

	const B& operator=(int a)
	{
		cout << "In operator=(int a) with " << a << endl;
		return *this;
	}
};

class C
{
private:
	B obj1;
	B obj2;
public:
	C() : obj1(4)
	{
		cout << "Just entered constructor C()" << endl;
		obj2 = 5;
	}
};

void main()
{
	C objC;
}

// End of program.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-211-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 03:43:01 2003
Return-Path: <uhcosc1320-return-211-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6O8h15Z1251875
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 03:43:01 -0500 (CDT)
Received: (qmail 12714 invoked by uid 108); 24 Jul 2003 08:47:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17336 invoked from network); 23 Jul 2003 18:44:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307231726.h6NHQg9Y698727@creek.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 23 Jul 2003 12:26:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Complex.h example (fwd)
Status: O
X-UID: 207
Content-Length: 963
X-Keywords: $NotJunk                                                                                           

>After creating Complex.h and .cpp, in main you have c3=c1+2.1.  Does the global operator- require only two complex objects?  Apparently the operator+ in the class doesn't require only two complex objects, considering how they are called in main, 

If you implement operator overloading for a binary operator (one that takes
two operands) as a member, you will have one argument. If you implement it
as global, you will have two arguments. In the case of the member, the
left operand becomes the "this" object and the right operand becomes the
argument.

>but how does it know whether to add 2.1 to the real part of c1 or the imaginary part of c1?  

It does not know. It is what you do in the operator overloaded method that
decides the action.

>Also is it possible to do c3=c1+(-2.1)?   Thanks.

Sure.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-212-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 03:47:30 2003
Return-Path: <uhcosc1320-return-212-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6O8lT5Z1174503
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 03:47:29 -0500 (CDT)
Received: (qmail 16184 invoked by uid 108); 24 Jul 2003 08:51:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10355 invoked from network); 24 Jul 2003 08:43:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240826.h6O8QUmR1128794@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:26:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 2... (fwd)
Status: O
X-UID: 208
Content-Length: 1356
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>On assignment 2 I'm confused on what to do with:
>
>1. Accessing a character out of the range of characters will throw an exception String::OutOfRange. The OutOfRange supports a method getError() which provides details about what happend.
>
>- So am I suppose to write an OutOfRange function that utilizes the getError() function?

OutOfRange is an innner class that has a method called getError. 

>- Also, could you explain what "catch(OutOfRange& exceptionObj)" does and why is exceptionObj of type OutOfRange?

This has got to do with the basics of exception handling which we will talk
about in class today. 

>2. String supports a ! operator which returns a true (non zero int) if the string object is empty.
>
>- With this one...I need to write an overloaded function of "int String::operator!()" ?
>

Yes, except, the return type instead of an int should be bool.

>3. The >> and << are overloaded for input/output.
>
>- I'm not sure how to overload these...could you give me a hint or refer me to an example.
>
>Thanks.

Your email was sent before the class yesterday. In class yesterday
we discussed this. Hopefully that clarified those for you. If not,
send me an email.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-213-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 03:48:11 2003
Return-Path: <uhcosc1320-return-213-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6O8mA5Z1179816
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 03:48:10 -0500 (CDT)
Received: (qmail 16716 invoked by uid 108); 24 Jul 2003 08:52:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11740 invoked from network); 24 Jul 2003 08:45:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240828.h6O8St831137196@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:28:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Having problem with exception (fwd)
Status: O
X-UID: 209
Content-Length: 947
X-Keywords: $NotJunk                                                                                           

>This is is with ASSIGN2.
>
>I throw the exception, but rather than it printing:
>
>20th char in the string is Access attempt position 19 on string of size 13
>
>It is just printing:
>
>Access attempt position 19 on string of size 13
>
>Either one of two things is happening.  Either it is tossing everything 
>in the buffer, overwriting it, or whatever, or it is evaluating the 
>stringObj[19] before the cout << "20th char in the string is ".
>
>This happens both under windows (bloodshed dev-c++) and linux (gcc 3.2.2).
>
>I'm still searching for a solution, but I'm wondering if this is something 
>you can tell me, if I gave you enough information.

How about trying to flush the cout before you throw the exception.
Please try that and let me know if this fixes the problem for you.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-214-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 06:18:34 2003
Return-Path: <uhcosc1320-return-214-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6OBIY5Z1551353
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 06:18:34 -0500 (CDT)
Received: (qmail 28301 invoked by uid 108); 24 Jul 2003 11:22:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9421 invoked from network); 24 Jul 2003 08:42:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240838.h6O8cMLd1149676@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:38:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] problem with cascading cout << when exception is thrown (fwd)
Status: O
X-UID: 210
Content-Length: 1264
X-Keywords: $NotJunk                                                                                           

>Venkat,
>          My assignment 2 is producing the desired output in every given
>test case except 1.  When the call to String[] throws an exception when
>called from the printString function in assign2.cpp, the const char * that
>was inserted into cout first seems to be gone.  Here is the code as a
>reference, then I will describe further, what my problem is.
> 
>try
>{
>cout << "20th char in the string is " << stringObj[19] << endl;
>}
>catch(OutOfRange& exceptionObj)
>{
>cout << exceptionObj.getError() << endl;
>}
> 
>If the call to String[] in the try block will result in an exception, in the
>case of the String "length" being < 20, then only the
>exceptionObj.getError() message is printed in the catch block.  The original
>"20th char in the string is " is gone.  
> 
>This is the output described in output.txt:
> 
>"20th char in the string is Access attempt position 19 on string of size 13"
> 
>Whereas I get:
> 
>"Access attempt position 19 on string of size 13" only.
> 
>Do you have any insight into my problem based on the description I've given,
>or would some code snippets be required?
> 
>thanks

Before you throw the exception, try flushing cout and see if this helps.
Please try this and let me know if that fixes the problem.

Venkat

From uhcosc1320-return-215-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 06:20:13 2003
Return-Path: <uhcosc1320-return-215-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6OBKD5Z1555430
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 06:20:13 -0500 (CDT)
Received: (qmail 29770 invoked by uid 108); 24 Jul 2003 11:24:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14248 invoked from network); 24 Jul 2003 08:49:06 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240844.h6O8iqin1163028@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:44:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Implementation of HW2 (fwd)
Status: O
X-UID: 211
Content-Length: 981
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>In Homework #2 , I have made the appropriate implementations (I think).
>And it builds perfect.
> 
>But when I try to create a PERSON in a main I wrote up, I get a great
>amount of linking errors. I fixed this problem by adding semicolons to
>the end of all the methods in the classes (which you gave to us, but I
>believe we cannot touch).
> 
>Why is it, that adding semicolons resolves this issue?
> 
>Do you want us to create a PERSON for debugging purposes? If so, would
>we have to add semicolons to the end of all the method declarations?
> 
>Look forward to your response.
> 
>Thanks,

I am sorry, you lost me here. There are semicolons at the end of method 
declarations in the classes already. So, I am not sure what you mean by this.

To avoid link errors, you need to implement each of the methods.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-216-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 06:21:01 2003
Return-Path: <uhcosc1320-return-216-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6OBL05Z1560009
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 06:21:00 -0500 (CDT)
Received: (qmail 30581 invoked by uid 108); 24 Jul 2003 11:25:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10366 invoked from network); 24 Jul 2003 08:43:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240835.h6O8ZoI11136774@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:35:49 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Examples from class (fwd)
Status: O
X-UID: 212
Content-Length: 1289
X-Keywords: $NotJunk                                                                                           

>Venkat,
>Would you please post the examples from 7/21 to now.

Done. (Note, no examples from 7/21).

>Also, in today example in class, why wouldn't you
>write 2 copy constructors for decrement inside Class
>Counter (as Member), but write them outside the Class
>(as Global)?  

(You do not write more than one copy constructor).
You mean why would I not write two overloaded methods
for decrement as members instead of global?

If that is your question is, yes I did mention that I would 
rather write these as members instead of global. The only
reason I wrote as global is to show you how to write it
as global if you wanted to.

>Would you please explain me again when
>we should write them inside Class and why should it be
>outside the Class.
>
>Thanks.

If you have a choice, you should write it as member only.
Some things like operator= can only be written as member,
you have no choice. Some things like overloading << for
objects of types that do not belong to your class (like ostream
on the left) or for the left operand being primitive type
(as in 2.1 + complex), you may not have a choice but
to write it as global.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-217-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 06:21:13 2003
Return-Path: <uhcosc1320-return-217-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6OBLC5Z1560439
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 06:21:12 -0500 (CDT)
Received: (qmail 30817 invoked by uid 108); 24 Jul 2003 11:25:19 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11277 invoked from network); 24 Jul 2003 08:44:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240840.h6O8eheq1152302@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:40:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign2: temp input variable for istream; (fwd)
Status: O
X-UID: 213
Content-Length: 733
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
... code deleted...
>
>I looked that the example on the ppt and it only shows int, but what
>about a string? It is incorrect to even guess the length of the input
>string ... but how do we allocate something in which we don't know until
>runtime? Do we use <string> and use a string class? If so, is there a
>way to convert string to char* ( perhaps that typecasting thing ) ?
>thanks
>

Good point! You do not know the size. So, you may assume a worst case
max. For example, some thing like 1024 as the size and that may be 
the limitation of the size you allow.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-218-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 06:22:05 2003
Return-Path: <uhcosc1320-return-218-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6OBM45Z1563652
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 06:22:04 -0500 (CDT)
Received: (qmail 31563 invoked by uid 108); 24 Jul 2003 11:26:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19486 invoked from network); 24 Jul 2003 08:56:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240851.h6O8puk21187538@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:51:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Overloading example (fwd)
Status: O
X-UID: 214
Content-Length: 595
X-Keywords: $NotJunk                                                                                           

>On slide 116 of the handouts, for the overloading >>, I was wondering what cobj.imp was?  I was trying to duplicate the script thats given and I was stuck trying to figure out what .imp was.  I figured the .rep was like a get function, but whats .imp for.  What kind of function or method is it?  Thanks.
>

rep stands of the real part of the Complex object. imp is the
imaginary part of the Complex object. These are member variables.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-219-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 07:31:33 2003
Return-Path: <uhcosc1320-return-219-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6OCVX5Z1211693
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 07:31:33 -0500 (CDT)
Received: (qmail 17708 invoked by uid 108); 24 Jul 2003 12:35:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23702 invoked from network); 24 Jul 2003 11:15:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240856.h6O8utco1197754@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:56:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign 2 (fwd)
Status: O
X-UID: 215
Content-Length: 552
X-Keywords: $NotJunk                                                                                           

>For this assignment, are we to create a operator! or do we just use the ! operator thats given.  The way it was stated in the instructions, I wasn't sure what needed to be done with ! operator.
>

Well, if ! is already given, you will not be able to overload.
If it not already given, you will get a compilation error if you
try to use it. So, go ahead the compile the code and you will know.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-220-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 07:31:45 2003
Return-Path: <uhcosc1320-return-220-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6OCVj5Z1210662
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 07:31:45 -0500 (CDT)
Received: (qmail 18219 invoked by uid 108); 24 Jul 2003 12:35:53 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26081 invoked from network); 24 Jul 2003 11:19:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240850.h6O8ogrb1186119@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:50:42 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment 2 (fwd)
Status: O
X-UID: 216
Content-Length: 1093
X-Keywords: $NotJunk                                                                                           

>I created a String object called hello and I initialized it to Hi.  When I print the String, I just type in 
>cout << hello << endl;
>and it prints it out for me.  I thought I needed to have like a get function to retrive this data because in my String class, I have const * ptr as a private member and in my String constructor I have:
>
>... deleted ...
>But when I create a get function such as:
>
>char* String::getstring() const{
>	return ptr;}
>
>and change the output commmand to :
>
>cout << hello.getstring() << endl;
>
>I get an error stating :
>
>warning C4761: integral size mismatch in argument; conversion supplied.  
>
>I am not sure whether to drop the get function since it works without it or whether to include it and use it to get my string contents.  Please advise.  Thanks.
>

You code should work fine without modifying the given main. 
If it works without getString, chances are it is using the 
overloaded <<.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-221-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 07:36:40 2003
Return-Path: <uhcosc1320-return-221-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6OCae5Z1218081
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 07:36:40 -0500 (CDT)
Received: (qmail 21746 invoked by uid 108); 24 Jul 2003 12:40:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26679 invoked from network); 24 Jul 2003 11:20:16 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240853.h6O8rDJC1191318@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:53:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Overloading >> (fwd)
Status: O
X-UID: 217
Content-Length: 368
X-Keywords: $NotJunk                                                                                           

>Is there any possible way that you could create the method for operator>> for the example problem that we worked on in class today?  Thanks.

Yes, there is! Bring up the question in class and we can write it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-222-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 07:48:30 2003
Return-Path: <uhcosc1320-return-222-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6OCmT5Z1251075
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 07:48:29 -0500 (CDT)
Received: (qmail 30909 invoked by uid 108); 24 Jul 2003 12:52:26 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27406 invoked from network); 24 Jul 2003 11:21:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240846.h6O8klRQ1170959@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:46:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubt Regarding '<<' operator overloading (fwd)
Status: O
X-UID: 218
Content-Length: 902
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> 
>I have a doubt regarding '<<' operator overloading sir.One of the students in the class had asked something regarding the following statement:
> 
>cout << "A Simple Example" << a << endl;
> 
>In the following statement:
> 
>cout << "A Simple Example" , whether a member or global function of 'cout' is called?
> 
>What my doubt is,  whether this member/global is different from the global operator<< function which you wrote in that example.
> 
>I think,i am making sense.
> 
>Thanks and Regards.

Absolutely. What we wrote is an overload of << for cout (ostream) and
a (Counter). In the case of cout << "A Simple Example" is the << for
cout (ostream) and "A Simple Example" (const char*).

The types involved are different.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-223-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 08:28:09 2003
Return-Path: <uhcosc1320-return-223-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6ODS95Z1354211
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 08:28:09 -0500 (CDT)
Received: (qmail 32300 invoked by uid 108); 24 Jul 2003 13:32:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32767 invoked from network); 24 Jul 2003 11:27:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240823.h6O8NmtB1117747@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:23:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign2 (fwd)
Status: O
X-UID: 219
Content-Length: 874
X-Keywords: $NotJunk                                                                                           

>In my String.cpp file I have the following code:
>... deleted...
With in one of the method of your class you have
>	String newString= *ptr + *operand2.ptr;
...
>
>When I try to run it, it gives me an error at "String newString= *ptr + *operand2.ptr;" stating that "error C2440: 'initializing' : cannot convert from 'int' to 'class String'"  Can you tell me where the errors coming from considering that there isn't really a conversion from int to String.  Thanks.

ptr is of type char*. *ptr gives you the first char of the array of
characters. Then you are adding that with the first character from
the array of the second char*? By default + does not behave well on
characters or character arrays. 

Hint: strcat

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-224-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 08:28:57 2003
Return-Path: <uhcosc1320-return-224-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6ODSu5Z1353914
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 08:28:57 -0500 (CDT)
Received: (qmail 662 invoked by uid 108); 24 Jul 2003 13:33:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 857 invoked from network); 24 Jul 2003 11:28:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240820.h6O8K6tV1118608@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:20:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] complex example & assign2 (fwd)
Status: O
X-UID: 220
Content-Length: 790
X-Keywords: $NotJunk                                                                                           

>In the complex example, you had 
>Complex Complex::operator+(const Complex& operand2) const
>and 
>Complex operator-(const Complex& operand1, 
>                  const Complex& operand2)
> The format that you use here, does it make any difference.  What I mean is that if the operator- was operator+, would there be any difference between the two.  If not, can we use either format when we have operator functions defined in our classes?  Thanks.
>

By format if you mean choosing member vs. global, we discussed when 
you would use one over the other and if you had a choice which one
you should prefer. Those details will apply.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-225-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 08:29:10 2003
Return-Path: <uhcosc1320-return-225-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6ODTA5Z1355053
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 08:29:10 -0500 (CDT)
Received: (qmail 898 invoked by uid 108); 24 Jul 2003 13:33:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24271 invoked from network); 24 Jul 2003 11:16:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240855.h6O8tXHO1197504@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:55:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] empty string (fwd)
Status: O
X-UID: 221
Content-Length: 791
X-Keywords: $NotJunk                                                                                           

>For the assignment 2, it states that an object of String can be created without any initialization.  If this is so, would we ever want to print that String?  I tried and a window of microsoft pops up telling me that assign2.exe has encountered a problem and needs to be closed.  If you run our program with your own codes and you have two empty objects of String concatenated, would you try to output the results?  Please advise.  Thanks.
>

Yes. First, in what is given, if I create

String s1;
String s2;

Both these strings hold "". That is '\0'.

Concatenating them, should result in a string with "" (that is '\0'),
isn't it?.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-226-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 08:29:59 2003
Return-Path: <uhcosc1320-return-226-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6ODTw5Z1352134
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 08:29:58 -0500 (CDT)
Received: (qmail 1659 invoked by uid 108); 24 Jul 2003 13:34:02 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23049 invoked from network); 24 Jul 2003 12:41:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307241237.h6OCbhWY1229106@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 07:37:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Having problem with exception (fwd)
Status: RO
X-UID: 222
Content-Length: 613
X-Keywords: $NotJunk                                                                                           

>> >I'm still searching for a solution, but I'm wondering if this is somethi=
>ng=20
>> >you can tell me, if I gave you enough information.
>>=20
>> How about trying to flush the cout before you throw the exception.
>> Please try that and let me know if this fixes the problem for you.
>I tried that with cout.flush(), but it still didn't do it.  Or perhaps
>that is the wrong function?

Hummm. Alright, I will give this a try myself and get back to you.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-227-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 08:30:53 2003
Return-Path: <uhcosc1320-return-227-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6ODUr5Z1359050
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 08:30:53 -0500 (CDT)
Received: (qmail 2615 invoked by uid 108); 24 Jul 2003 13:34:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23703 invoked from network); 24 Jul 2003 11:16:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307240857.h6O8vgOM1167035@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 03:57:42 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] ! operator (fwd)
Status: O
X-UID: 223
Content-Length: 516
X-Keywords: $NotJunk                                                                                           

>Do we need to return a 1 or "true" if the string object is empty.  I am kind of confussed because in the output provided, you have a message as if or not the string object is empty or not. Is it okay if my ! operator outputs a char message stating if the string is empty or not?  Thanks.

No, it will not be ok to output a message. It should return a bool.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-228-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 23:08:18 2003
Return-Path: <uhcosc1320-return-228-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6P48H5Z1466442
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 23:08:18 -0500 (CDT)
Received: (qmail 30240 invoked by uid 108); 25 Jul 2003 04:12:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30654 invoked from network); 24 Jul 2003 13:30:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307241236.h6OCa2db1222452@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 07:36:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Implementation of HW2 (fwd)
Status: O
X-UID: 224
Content-Length: 1805
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Oops, and this is what happens when one writes emails so late at
>night...

:)

>I meant empty BRACKETS after every method, right before the semicolons.
>
>For example, I changed the source file to:
>
>	String(const char* str){};
>	String(const String& other){};
>	const String& operator=(const String& other){};
>	const String& operator=(const char* str){};
>	~String(){};
>
>And that avoided these errors:
>hw2.obj : error LNK2001: unresolved external symbol "public: __thiscall
>String::~String(void)" (??1String@@QAE@XZ)
>hw2.obj : error LNK2001: unresolved external symbol "public: __thiscall
>String::String(char const *)" (??0String@@QAE@PBD@Z)
>Debug/Homework2.exe : fatal error LNK1120: 2 unresolved externals
>
>When I try to make a person in the main I wrote:
>	
>	const char* name="MyName";
>	long date=12102002;
>	int q=60;
>	int income=40;
>
>	Person Student(name,date,q,income);
>
>I just wanted to make a "Person" for debugging purposes, I do not know
>if you expect us to take this homework that far.
>
>Sorry about the other "semicolon" email.
>
>Thanks,

By adding {}, you are providing an empty implementation for the methods.
The way to avoid link errors is to implement the methods. Whether the
implementation is correct or not is not an issue for the link  error
to go away. So, that is why the link errors disappeared when you added
empty implementations. 

For this HW, you were not required to write code or compile at all! I asked 
people to go ahead and try that since they were not sure how to write
the constructor and one way to find out is to write it.

So, not to worry about the issue you are facing.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-229-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 24 23:13:04 2003
Return-Path: <uhcosc1320-return-229-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6P4D45Z1479958
	for <cosc155g@bayou.uh.edu>; Thu, 24 Jul 2003 23:13:04 -0500 (CDT)
Received: (qmail 1637 invoked by uid 108); 25 Jul 2003 04:17:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 876 invoked from network); 25 Jul 2003 04:16:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307250411.h6P4BuWv1479207@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 24 Jul 2003 23:11:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Instructions for submitting Assignment 2
Status: O
X-UID: 225
Content-Length: 1179
X-Keywords: $NotJunk                                                                                           



Please read this carefully.


1. Make sure your name appears in the .h and .cpp file(s).
2. Put the .h and .cpp files in a directory named
	assign2.
3. I am assuming you have installed winzip on your system.
	If you want to use some other zip program, that is fine as well.
4. If you are using winzip, right click on the assign2 directory
	and select zip to assign2.zip.
5. Visit the course web site at http://www.cs.uh.edu/~svenkat/summer2003.
6. Follow the link that says submit assignment.
7. Enter your email address and click on Forgot Password? link to find 
	your password.
8. After checking your email, enter the ID (password) and click submit.
9. Click the browse button that shows up, and select the assign2.zip file.
10. Click send to submit.

Make sure it says the submit was successful.

You can submit your assignment as many times as you like until
the deadline. The latest submission is the one that will be kept.

This has been tested with IE browser.

Please let me know if you have any difficulties.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-230-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 06:15:59 2003
Return-Path: <uhcosc1320-return-230-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PBFw5Z1467480
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 06:15:58 -0500 (CDT)
Received: (qmail 19819 invoked by uid 108); 25 Jul 2003 11:20:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17354 invoked from network); 25 Jul 2003 11:17:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251112.h6PBCh2l1464680@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:12:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] assign2 (fwd)
Status: O
X-UID: 226
Content-Length: 477
X-Keywords: $NotJunk                                                                                           

>I thought of using strcat but isn't this going to change "this"?  I thought we maybe needed to assign it to another String object, and so I tried messing with the *ptr + *operand2.ptr.  Thanks.

You are right, + should not affect either of the operands. So, use
strcat in a way that you do not affect either of those.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-231-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 06:17:10 2003
Return-Path: <uhcosc1320-return-231-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PBH95Z1477535
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 06:17:09 -0500 (CDT)
Received: (qmail 20938 invoked by uid 108); 25 Jul 2003 11:21:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20765 invoked from network); 25 Jul 2003 11:21:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251116.h6PBGlJ71476979@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:16:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment 2 (fwd)
Status: O
X-UID: 227
Content-Length: 962
X-Keywords: $NotJunk                                                                                           

>While running the following code:
>
>#include <iostream>
>#include "String.h"
>using namespace std;
>
>void main(){
>	String hello="testing";
>	String hi="Hi";
>	cout << hello << endl;
>	cout << hello.operator+(hi) << endl;
>	cout << hello[2] << endl;
>	cout << !hello << endl;} 
>
>everything seems to be working fine.  I place a breakpoint as it leaves main ( at } )and I see how hi gets deleted first and then hello.  When it comes time to delete hello, I get a debug error.  I am not sure if it has anything to do with the String destuctor since all it contains is :
>
>String::~String(){
>	delete[] ptr;}
>
>where ptr is a private member char*.  Am I missing something in my destructor thats causing this problem.  Thanks for this assistance.  
>

Make sure you have followed the Law of Big Three.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-232-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 06:31:22 2003
Return-Path: <uhcosc1320-return-232-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PBVM5Z1508435
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 06:31:22 -0500 (CDT)
Received: (qmail 32168 invoked by uid 108); 25 Jul 2003 11:35:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31158 invoked from network); 25 Jul 2003 11:34:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251129.h6PBTt5V1507158@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:29:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Problems understanding Initializing list (fwd)
Status: O
X-UID: 228
Content-Length: 2600
X-Keywords: $NotJunk                                                                                           

>HI Venkat,
>
>"Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU> wrote:When an object of a class is created, its internals (guts) are created
>first. Then the constructor's body is called. 
>
>Consider the class
>
>class A
>{
>private:
>int v1;
>int v2;
>public: 
>A() : v1(4)
>{
>// by the time the run time gets here, the guts of A has
>// been created. Here is variable v1 has been initialized
>// (already constructed) to a value of 4. The variable v2
>// has been initialized to what ever garbage was at that
>// memory location. In other words, both v1 and v2 have
>// been created.
>
>v2 = 5; // You are not initizlizing v2 here. You are simply
>// assignning to it now.
>} 
>};
>
>In the A() : v1(4), you are telling the compiler (or run time) to 
>initialize v1 to 4 and initialize v2 to what ever the default is,
>and in C++, the default is to leave what ever is at that memory location.
>
>Now consider the following example (Go ahead and execute this,
>step through the code to understand it):
>
>// Save this to main.cpp and compile and run
>#include 
>using namespace std;
>
>class B
>{
>public:
>B()
>{
>cout << "In B()" << endl;
>}
>
>B(int a)
>{
>cout << "In B(int a) with " << a << endl;
>}
>
>const B& operator=(int a)
>{
>cout << "In operator=(int a) with " << a << endl;
>return *this;
>}
>};
>
>class C
>{
>private:
>B obj1;
>B obj2;
>public:
>C() : obj1(4)
>{
>cout << "Just entered constructor C()" << endl;
>obj2 = 5;
>}
>};
>
>void main()
>{
>C objC;
>}
>
>// End of program.
>
>Venkat Subramaniam
>-- 
>cosc155g@bayou.uh.edu Department of Computer Science
>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475
>
>In the above program I dont understand how in the constructor of B there is no assignment to any private variable.  In other words when you say
>
>C() : obj1(4)
>I dont understand how the number 4 is being assigned to any part of the class B of which type obj1 is.
>
>Thanks

The example is to illustrate and understand how the sequence of calls
to various constructors work. It is not my concern what exactly is
happening or not happening within the constructor of B. If you want to
put a private member variable within B and then assign that value
to what is being passed into the constructor of B, you can do that.
That will not help in any way with what is being communicated in this
example - and that is the sequence of calls to constructors of B with
respect to that of C.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-233-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 06:34:14 2003
Return-Path: <uhcosc1320-return-233-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PBYE5Z1518644
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 06:34:14 -0500 (CDT)
Received: (qmail 2306 invoked by uid 108); 25 Jul 2003 11:38:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32054 invoked from network); 25 Jul 2003 11:35:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251130.h6PBUsQb1484905@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:30:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator= (fwd)
Status: O
X-UID: 229
Content-Length: 578
X-Keywords: $NotJunk                                                                                           

>When we create the operator=, is it sufficient enough to say that "this" is equal to operand2.  All that we need for this overloaded function to do is just have one operand equal to another operand.  But when we do this, will it call on the copy constructor even though "this" already is created but not initialized?  Thanks.

Any form of constructor is called only when an object is being created. Not
at other times.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-234-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 06:36:33 2003
Return-Path: <uhcosc1320-return-234-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PBaX5Z1526045
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 06:36:33 -0500 (CDT)
Received: (qmail 4418 invoked by uid 108); 25 Jul 2003 11:40:46 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1913 invoked from network); 25 Jul 2003 11:37:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251133.h6PBXVrJ1519351@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:33:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assign2: Possible errors in assign2.cpp and String.cpp you provided (fwd)
Status: O
X-UID: 230
Content-Length: 751
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>1. In assign2.cpp, the catch statements should be written as
>
>catch(String::OutOfRange& exceptionObj)
>
>instead of
>
>catch(OutOfRange& exceptionObj)
>
>right?

Keep it to what ever it is in main (assign2.cpp).
Do not change it in main.

>2. In String.cpp you give
>
>#include <strings.h>
>
>Do you mean #include <string.h>

This may be different between the PC and the UNIX version.
Use what works for your system.

>3. In String.cpp, instead of #include <stdio.h>, can we include <iostream>?
>
>Thanks,

Try it! What you do within String.cpp and String.h is your choice.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-235-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 06:39:08 2003
Return-Path: <uhcosc1320-return-235-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PBd75Z1528828
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 06:39:07 -0500 (CDT)
Received: (qmail 6747 invoked by uid 108); 25 Jul 2003 11:43:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3417 invoked from network); 25 Jul 2003 11:39:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251135.h6PBZAds1517048@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:35:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] changing main.cpp (fwd)
Status: O
X-UID: 231
Content-Length: 467
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>I was wondering if it was alright to change 1) #include <iostream> to <iostream.h> 
>2) delete using namespace std; You said not to modify the code.
>When I use main as you have, I get errors.
>
>Thank You,


Do not change assign2.cpp. What you do within String.h and String.cpp
is up to you.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-236-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 06:43:15 2003
Return-Path: <uhcosc1320-return-236-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PBhE5Z1540957
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 06:43:15 -0500 (CDT)
Received: (qmail 10455 invoked by uid 108); 25 Jul 2003 11:47:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6296 invoked from network); 25 Jul 2003 11:42:47 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251138.h6PBcR5e1359878@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:38:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 2: OutOfRange scope resolution and cout problem (fwd)
Status: O
X-UID: 232
Content-Length: 1613
X-Keywords: $NotJunk                                                                                           

>You have in the requirements:
>
>// o Accessing a character out of the range of characters will throw an
>//    exception String::OutOfRange. The OutOfRange supports a method...
>
>If I write the OutOfRange class interface inside of the String class 
>interface then I fail to compile because in the assign2.cpp file it 
>needs "catch(String::OutOfRange& exceptionObj)" instead of how its 
>written "catch(OutOfRange& exceptionObj)".  If I define the OutOfRange 
>class interface outside of the String class interface then it works 
>fine.  Is there something we are suppose to do with namespaces to fix 
>this, or are we just suppose the define the OutOfRange class outside of 
>the String class?

Define it outside the class. 

>Also, I am having the same problem a couple others wrote about.  I am 
>getting in my output:
>"Access attempt position 19 on string of size 13" instead of "20th char 
>in the string is Access attempt position 19 on string of size 13".
>I am using Bloodshed Dev-C++ which uses the Mingw compiler.  Other than 
>those two things everything is running fine, thanks for the help.

This was addressed in the previous email this morning.
I have modified the assign2.cpp to this effect. You may want to
get a new copy of the assign2.cpp file or make this one change to
the copy you have:

cout << "20th char in the string is " 
	<< stringObj[19] << endl;

to

cout << "20th char in the string is ";
cout << stringObj[19] << endl;
Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-237-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 06:57:02 2003
Return-Path: <uhcosc1320-return-237-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PBv15Z1535425
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 06:57:01 -0500 (CDT)
Received: (qmail 21224 invoked by uid 108); 25 Jul 2003 12:01:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13423 invoked from network); 25 Jul 2003 11:51:11 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251146.h6PBkprV1552422@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:46:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problem with assignment2 (fwd)
Status: O
X-UID: 233
Content-Length: 1537
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>      Sorry for e-mailing you at this hour, but I have been trying to figure out what I did wrong in my code and I have been unable to to come up with anything. Could you please help me? 
>      When I implement my String.cpp, it compiles with no errors. But when I try to compile main.cpp or try to link my program, it gives me errors such as:
> 
> c:\string\main.cpp(22) : error C2061: syntax error : identifier 'OutOfRange'
>c:\string\main.cpp(22) : error C2310: catch handlers must specify one type
>c:\string\main.cpp(24) : error C2065: 'exceptionObj' : undeclared identifier
>c:\string\main.cpp(24) : error C2228: left of '.getError' must have class/struct/union type
>c:\string\main.cpp(27) : error C2317: 'try' block starting on line '19' has no catch handlers
>c:\string\main.cpp(32) : error C2061: syntax error : identifier 'OutOfRange'
>c:\string\main.cpp(32) : error C2310: catch handlers must specify one type
>c:\string\main.cpp(34) : error C2228: left of '.getError' must have class/struct/union type...
> 
>I think it has to do with my String.h file but I can't come up with what I might be doing wrong. Here is my String.h file:
> 
>... deleted...
>Could you please help me? Thanks for your time and sorry for the hour once again.

Move the exception class to outside the String class (but keep it
within the String.h file) and it should work fine.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-238-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 07:02:17 2003
Return-Path: <uhcosc1320-return-238-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PC2G5Z1066966
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 07:02:16 -0500 (CDT)
Received: (qmail 25168 invoked by uid 108); 25 Jul 2003 12:06:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19589 invoked from network); 25 Jul 2003 11:59:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251145.h6PBj2sM1547381@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:45:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubt Regarding Exception Handling (fwd)
Status: O
X-UID: 234
Content-Length: 974
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> 
>In slide 121 of exception hamdling, there are two catch blocks.
> 
> 
>catch(invalidNumber&)
> {
>  cerr << " Error.Invalid Number.\n" <<endl;
> }
> 
>catch(divisionByZero&)
> {
>  cerr << " Error.Division By Zero..\n" <<endl;
> 
> } 
> 
> 
>catch(divisionByZero&)
> {
>  cout<< " Division by zero" <<endl;
>  
> }
> 
> 
>Is, 'cerr'  equivalent to 'cout'. If not, in what do they differ. 
> 
>Could you please clarify.
> 
>Thanks and Regards.

A program has three things available to it. Standard input,
standard output and standard error. Standard input is the channel
through which it gets the input. The Standard output is to
print the normal output. Standard error is a channel to send the
error messages. 

In C++, these three are represented by the objects cin, cout and cerr,
respectively.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-239-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 07:10:42 2003
Return-Path: <uhcosc1320-return-239-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PCAg5Z1085530
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 07:10:42 -0500 (CDT)
Received: (qmail 31778 invoked by uid 108); 25 Jul 2003 12:14:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10352 invoked from network); 25 Jul 2003 11:47:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251143.h6PBh3F61539052@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:43:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] 'cout' : ambiguous symbol (fwd)
Status: O
X-UID: 235
Content-Length: 763
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>If I receive the compilation error message: error C2872: 'cout' : ambiguous symbol, I would be suspect that I had not properly overloaded the operator <<
>(and >> for that matter).  But I beleive that I implemented the functions as
>we discussed in class.  Any assistance or hints in this dilemma would be greatly appreciated.  I have defined both globally with the following code:
>
>... deleted...
>
>Thank you for your time.
>

The only thing I can think of is - are you mixing iostream and iostream.h?

If you still have this problem, email me to code and I will take a closer
look at it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-240-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 07:11:29 2003
Return-Path: <uhcosc1320-return-240-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PCBT5Z1086837
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 07:11:29 -0500 (CDT)
Received: (qmail 32429 invoked by uid 108); 25 Jul 2003 12:15:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7333 invoked from network); 25 Jul 2003 11:43:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251126.h6PBQ1Wg1500800@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:26:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] exam dates (fwd)
Status: O
X-UID: 236
Content-Length: 625
X-Keywords: $NotJunk                                                                                           

>Hello Venkat.  ... Can you tell me what dates exam 3 and the final exam 
>will be ...

There is no final exam in this course.

Midterm 2 will be on Thursday July 31st. 

Midterm 3 is currently scheduled for Aug. 7th, but that may change.
We will decide on that next week.

Topics for Midterm 2 includes all materials covered in class until
yesterday (July 24th) - excluding what was already on midterm 1.
In other words, we have sessions 5, 6, 7, 8 from the slides.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-241-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 07:24:27 2003
Return-Path: <uhcosc1320-return-241-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PCOQ5Z1119045
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 07:24:26 -0500 (CDT)
Received: (qmail 10725 invoked by uid 108); 25 Jul 2003 12:28:34 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27294 invoked from network); 25 Jul 2003 10:50:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251045.h6PAjhuY1397772@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 05:45:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] no access to cout to "flush the buffer" (fwd)
Status: O
X-UID: 237
Content-Length: 659
X-Keywords: $NotJunk                                                                                           

>Venkat,
>      The exception is thrown from my "char& String::operator[](const int
>index) const".  At that point, I don't have any reference to the ostream
>from the caller.  Would everything still work if I were to instantiate my
>own ostream and flush that?  I wouldn't think that would work.

cout is a global object. You simply call flush on it. All you have to
do is include iostream. Again, previous emails reported that this
is still not serving the purpose. I will take a closer look at it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-242-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 07:29:52 2003
Return-Path: <uhcosc1320-return-242-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PCTp5Z1135073
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 07:29:52 -0500 (CDT)
Received: (qmail 15026 invoked by uid 108); 25 Jul 2003 12:34:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4130 invoked from network); 25 Jul 2003 11:40:17 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251135.h6PBZv5K1521448@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:35:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] changing String.cpp (fwd)
Status: O
X-UID: 238
Content-Length: 338
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>I was wondering what #include <strings.h> does.  I get errors when I use it.
>
>Thanks

On the PC, this may be #include <string.h> instead of #include <strings.h>.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-243-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 07:30:09 2003
Return-Path: <uhcosc1320-return-243-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PCU95Z1136362
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 07:30:09 -0500 (CDT)
Received: (qmail 15408 invoked by uid 108); 25 Jul 2003 12:34:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8060 invoked from network); 25 Jul 2003 12:25:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251105.h6PB5h5h1447025@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:05:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Having problem with exception (fwd)
Status: O
X-UID: 239
Content-Length: 1363
X-Keywords: $NotJunk                                                                                           

>>> >I'm still searching for a solution, but I'm wondering if this is somethi=
>>ng=20
>>> >you can tell me, if I gave you enough information.
>>>=20
>>> How about trying to flush the cout before you throw the exception.
>>> Please try that and let me know if this fixes the problem for you.
>>I tried that with cout.flush(), but it still didn't do it.  Or perhaps
>>that is the wrong function?
>
>Hummm. Alright, I will give this a try myself and get back to you.
>

Alright here is what I found.

On Unix GNU version of the compiler (on bayou), it behaves like the
output I have given. In

cout << "20th char in the string is " 
	<< stringObj[19] << endl;

The output of the string "20th char in the string is" is first
executed and then the operator[] on String is called. This is
what I see on bayou.

However, on the PC with Visual Stdio, the operator[] on String
executes first, before the output of the "20th..." string.

Hence the difference in behavior you see. Putting cout.flush()
will not help.

I suggest the following change to assign2.cpp.

Modify

cout << "20th char in the string is " 
	<< stringObj[19] << endl;

to

cout << "20th char in the string is ";
cout << stringObj[19] << endl;

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-244-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 08:10:13 2003
Return-Path: <uhcosc1320-return-244-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PDAD5Z1235296
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 08:10:13 -0500 (CDT)
Received: (qmail 11716 invoked by uid 108); 25 Jul 2003 13:14:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7396 invoked from network); 25 Jul 2003 12:24:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251111.h6PBBs9Z1446708@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:11:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] HW2 questions 2 and 3 (fwd)
Status: O
X-UID: 240
Content-Length: 1097
X-Keywords: $NotJunk                                                                                           

>Can u please verify the answers
>
>q:2
>
>I will put brain and string in the initialization
>list, because brain and string's constructor need an
>initial value

Reasoning is that these two classes do not have
a constructor which takes no argument. Since the
call to constructor of String and Brain executes 
before the body of the constructor of the  Person
executes, you are required to provide these in the
initialization list.

>Q3
>
>I will put birthdate,birthdate, income in the
>constructor body because they dont nned any intial
>values before constructing it
>
>thanks

Actually, since birthdate is a const, it can not be assigned
a value. It can only be initialize. So, you are forced to
provide this in the initalization list as well.

For income, you have a choice of putting it in the initialization
list or in the body. Makes no difference. In order to favor
better readability, I would put that in the body of constructor.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-245-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 08:10:58 2003
Return-Path: <uhcosc1320-return-245-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PDAw5Z1233197
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 08:10:58 -0500 (CDT)
Received: (qmail 12707 invoked by uid 108); 25 Jul 2003 13:15:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 430 invoked from network); 25 Jul 2003 12:15:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251113.h6PBDLen1463316@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:13:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] using delete[] (fwd)
Status: O
X-UID: 241
Content-Length: 368
X-Keywords: $NotJunk                                                                                           

>hi Venkat
>
> if I declare some variables like below
>a = new int;
>b = new int[10];
>
>when I deallocate these variables
>
>for a ---->delete a
>for b ----->delete[] b
>
>is this rt?
>
>Thanks

Sounds right.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-246-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Jul 25 08:12:09 2003
Return-Path: <uhcosc1320-return-246-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6PDC85Z1242104
	for <cosc155g@bayou.uh.edu>; Fri, 25 Jul 2003 08:12:08 -0500 (CDT)
Received: (qmail 13662 invoked by uid 108); 25 Jul 2003 13:16:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7504 invoked from network); 25 Jul 2003 12:24:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307251107.h6PB7mO41454256@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 25 Jul 2003 06:07:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] empty string (fwd)
Status: O
X-UID: 242
Content-Length: 365
X-Keywords: $NotJunk                                                                                           

>After you concatenate two empty String objects, is it safe to output their results to the screen?  

If concatenating two empty strings returns an empty string, then
you can output the empty string safely.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-247-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 05:44:44 2003
Return-Path: <uhcosc1320-return-247-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QAih5Z1313885
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 05:44:43 -0500 (CDT)
Received: (qmail 15460 invoked by uid 108); 26 Jul 2003 10:49:03 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9058 invoked from network); 26 Jul 2003 10:39:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261035.h6QAZEIb1293835@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 05:35:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] due date for assign2 (fwd)
Status: O
X-UID: 243
Content-Length: 416
X-Keywords: $NotJunk                                                                                           

>Is assignment 2 due by 12am Monday July 28, or 12am Sunday July 27.  Asking for reassurance.  Also, we use the same method, submitting online, as before?  Thanks.

It is due on Sunday night. You will have the entire day on Sunday
to work on it if you like.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-248-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 05:52:52 2003
Return-Path: <uhcosc1320-return-248-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QAqq5Z1336707
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 05:52:52 -0500 (CDT)
Received: (qmail 20205 invoked by uid 108); 26 Jul 2003 10:57:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15275 invoked from network); 26 Jul 2003 10:48:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261044.h6QAiK5C1321471@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 05:44:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] << operator overloading on string (fwd)
Status: O
X-UID: 244
Content-Length: 834
X-Keywords: $NotJunk                                                                                           

>hi Venkat
>
>I was trying to execute the following code::
>void main()
>{
>String hello ="Hello";
>cout<< hello << endl;
>}
>
>my code for the << overloading is a follows .it gives
>me a link error "Unresolved external symbol".I am
>using .net. Can u please help me?
>
>... deleted...
>
>Thnaks

You need to declare the method in the String.h and implement it
in the String.cpp. See how I have declared operator<< in the
Counter.h and implemented it in the Complex.cpp file in the
example I wrote in class on 07/23.

Second, make sure you have included iostream and not iostream.h.

If neither of these fix the problem, email me the code and I will
take a closer look at it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-249-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 05:56:04 2003
Return-Path: <uhcosc1320-return-249-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QAu35Z1347497
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 05:56:03 -0500 (CDT)
Received: (qmail 22279 invoked by uid 108); 26 Jul 2003 11:00:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16979 invoked from network); 26 Jul 2003 10:51:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261047.h6QAl3R81327097@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 05:47:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: [uhcosc1320] empty string (fwd)
Status: O
X-UID: 245
Content-Length: 491
X-Keywords: $NotJunk                                                                                           

>I tried this and I get a debug error.  I try to debug it and see two empty strings being concatenated but trying to output the empty string to the screen seems to give a debug error.  Any suggestions. Thanks.

You may want to refer to the C library and see how you can 
properly contenate strings using strcpy, strcat and 
strncat.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-250-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 05:58:16 2003
Return-Path: <uhcosc1320-return-250-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QAwG5Z1352127
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 05:58:16 -0500 (CDT)
Received: (qmail 24290 invoked by uid 108); 26 Jul 2003 11:02:35 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11545 invoked from network); 26 Jul 2003 10:43:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261038.h6QAckur1299317@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 05:38:46 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment2 (fwd)
Status: O
X-UID: 246
Content-Length: 1047
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>        What you suggested, putting the exception class outside of the String class but inside the String.h file, works fine. But then, I wouldn't be able to define OutOfRange methods like  String::OutOfRange::OutOfRange... because OutOfRange wouldn't be a member of String. Is this fine by you? beacause this was how you wrote in assignment2 when explaining the String.h file.

There is a confusion between what's said in String.h and the code
that is in assign2.cpp. 

Write the OutOfRange class as a regular class and not as a nested class.

You can write OutOfRange class either within the String.h file (outside
of the String class) or you can write it in a separate file. It is 
up to you. You are responsible for submitting all files that are needed
to compile your code. If you do not submit some code that is needed,
your assignment will be considered as incomplete.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-251-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:01:11 2003
Return-Path: <uhcosc1320-return-251-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QB1A5Z1198527
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:01:10 -0500 (CDT)
Received: (qmail 26421 invoked by uid 108); 26 Jul 2003 11:05:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12721 invoked from network); 26 Jul 2003 10:44:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261040.h6QAePs81154682@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 05:40:25 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment 2 main (fwd)
Status: O
X-UID: 247
Content-Length: 1077
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>If we change 
>cout << "20th char in the string is " 
>     << stringObj[19] << endl;
>
>to
> 
>cout << "20th char in the string is "; 
>cout << stringObj[19] << endl;
>
>will this affect the code when you compile it?  When I don't make the change the output is not correct but when I make the change it is correct.
>

The assig2.cpp that I have (and will be using) has the second version
mentioned above and that is what I will be using. You may get an updated
copy of this file from the assignment directory on the web.

>Also, in main using namespace std; creates an error---
>
>C:\Program Files\Microsoft Visual Studio\MyProjects\ASSIGNMENT2\main.cpp(3) : error C2871: 'std' : does not exist or is not a namespace
>Error executing cl.exe.
>
>what do I do?

Make sure you have included iostream and not iostream.h.

>One last question...when are our grades going to be posted on internet?
>
>Thanks,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-252-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:02:56 2003
Return-Path: <uhcosc1320-return-252-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QB2t5Z1356791
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:02:55 -0500 (CDT)
Received: (qmail 27713 invoked by uid 108); 26 Jul 2003 11:07:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22014 invoked from network); 26 Jul 2003 11:00:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261055.h6QAtYNq1348862@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 05:55:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Compiling assign2 (fwd)
Status: O
X-UID: 248
Content-Length: 578
X-Keywords: $NotJunk                                                                                           

>I have made OutOfRange.h, OutOfRange.cpp, String.h, and String.cpp.&nbsp; I have to add #include "OutOfRange.h" in the assign.cpp to be able to run with no errors.&nbsp; Are we suppose to make create each class in a separate file or will you include the OutOfRange header file when you run our programs.

Do not include any thing else in assign2.cpp. If you want to include
OutOfRange.h, include that in your String.h.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-253-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:04:37 2003
Return-Path: <uhcosc1320-return-253-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QB4b5Z1371366
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:04:37 -0500 (CDT)
Received: (qmail 28843 invoked by uid 108); 26 Jul 2003 11:08:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20187 invoked from network); 26 Jul 2003 10:57:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261052.h6QAqhZ31342623@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 05:52:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Flushing Cout (fwd)
Status: O
X-UID: 249
Content-Length: 1212
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>
>In one of your replies you asked to flush cout for the right output. But 
>what does it mean by flushing cout?? How can I do that and what does it do 
>to the output?
>
>Thank you,

When you write

cout << "hello";

The hello is not written to the terminal. Instead, it sits in a buffer.
This buffer will collect every thing that is output, until it 
reaches a certain size when it is actually printed (or flushed) to 
the terminal. 

By using flush, you are asking the buffer to be printed and emptied
right then.

Try running the following:

#include <iostream>
#include <unistd.h> // replace this with #include <windows.h> on PC
using namespace std;

void main()
{
	cout << "hello ";

	sleep(10); // replace with Sleep(10000) on PC

	cout << "there ";
	cout.flush();

	sleep(10); // replace with Sleep(10000) on PC

	cout << "! ";
}

You will notice that nothing is printed for the first 10 seconds
even though we have called cout << "hello";

Then in one burst, hello there is printed. Then after another 10 seconds
delay ! is printed.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-254-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:05:10 2003
Return-Path: <uhcosc1320-return-254-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QB5A5Z1373675
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:05:10 -0500 (CDT)
Received: (qmail 29460 invoked by uid 108); 26 Jul 2003 11:09:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26106 invoked from network); 26 Jul 2003 11:05:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261100.h6QB0ZUu1358563@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:00:35 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problem w. overloading operator << and >>!!!! (fwd)
Status: O
X-UID: 250
Content-Length: 750
X-Keywords: $NotJunk                                                                                           

>Hi Venkat, I'm having some problems with overloading operator << and >>. 
>When I compile the main function, the compiler cries: error C2679: binary 
>'<<' : no operator defined which takes a right-hand operand of type 'const 
>class String' (or there is no acceptable conversion). I tried to compare my 
>codes and the ones we wrote in class, it seems like they are almost the 
>same. Is there something wrong with my codes or any suggestion???
>
>...deleted...
>Thanks for reading.

Please read the email I sent a few minutes ago to the class.
That should help solve the problem for you.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-255-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:05:11 2003
Return-Path: <uhcosc1320-return-255-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QB5B5Z1370171
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:05:11 -0500 (CDT)
Received: (qmail 29469 invoked by uid 108); 26 Jul 2003 11:09:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25284 invoked from network); 26 Jul 2003 11:03:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261059.h6QAxT0R1359561@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 05:59:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problem with Assign2 overloading [] or = (fwd)
Status: O
X-UID: 251
Content-Length: 1336
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I have been fighting this thing for hours.  I hope you can shed some light on this for me.  My problem is on the line in main that reads "greet[1] = 'i' ".  I keep getting this error: C2106: '=' : left operand must be l-value.  I have tried to rewrite my overloaded = and my overloaded [].  I was able to get that to go away and give me type miss matches instead.  However, when I did that I was breaking other parts of my code that was giving me the desired output.  Ultimately, I have come back to this.  I am coping  my code from String.cpp and String.h so you can maybe see something I could not.  I am running on  Windows 200, Microsoft Visual Studio 6.0.
>
>Any help you can give would be greatly appreciated.
>
> ...deleted...

When overloading the signature should be different. The const at
the far right is considered to be part of the signature. So you can 
write one method with the const at far right and another without it and
this is considered proper overloading.

Write two operator[] overloaded methods. One will return a
char& and will be a non-const method (modifier). Another will
return a const char& and will be a const method (query method).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-256-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:10:12 2003
Return-Path: <uhcosc1320-return-256-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QBAB5Z1386717
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:10:12 -0500 (CDT)
Received: (qmail 360 invoked by uid 108); 26 Jul 2003 11:14:26 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27632 invoked from network); 26 Jul 2003 11:07:05 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261102.h6QB2eTX1367362@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:02:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Overloading << and >> (fwd)
Status: O
X-UID: 252
Content-Length: 751
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>Whenever I compile, I get these errors for my input & output
>overloading functions:
>
>error C2804: binary 'operator <<' has too many parameters
>error C2804: binary 'operator >>' has too many parameters
>Error executing cl.exe.
>
>String.obj - 2 error(s), 0 warning(s)
>
>...deleted...
>
>Thanks for all your help.

We discussed when a operator overloading should be member and
when it should be global. You have made operator<< for
ostream and String as member. It can not be member. Make it
a public function. Simply move the declaration of the method
to outside the class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-257-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:17:34 2003
Return-Path: <uhcosc1320-return-257-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QBHY5Z1403421
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:17:34 -0500 (CDT)
Received: (qmail 5377 invoked by uid 108); 26 Jul 2003 11:21:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32357 invoked from network); 26 Jul 2003 11:13:47 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261109.h6QB9MFf1374529@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:09:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assingment2 (fwd)
Status: O
X-UID: 253
Content-Length: 1097
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>    When I run my program, it runs fine but a box pops up and tells me there is a bug on the heap (not in these words exactly) after running it. 

How lucky, you get special messages!

>I have debugged it and could not find anything. I know it has to do with the deletion of char arrays but I can't find it. Can you help please? Here is my code:

>... code deleted...
>
>I would really appreciate it. Thanks.
>

Couple of troubling things in the code:

1. never call strlen on a char* without checking if that is zero.

	size = strlen(pInput);

	should be 
	if (pInput != 0)
	{
		size = strlen(pInput);
	}

2. p = new char[0];

	You have created a array of 0 characters. To store the empty
	string, you need

	p = new char[1];
	*p = '\0';

Finally one more thing. There is absolutely no reason to keep a separate 
member to know the length of the string. At any time, you can call strlen
on your char* member and find out.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-258-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:18:19 2003
Return-Path: <uhcosc1320-return-258-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QBIJ5Z1402444
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:18:19 -0500 (CDT)
Received: (qmail 5958 invoked by uid 108); 26 Jul 2003 11:22:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2457 invoked from network); 26 Jul 2003 11:17:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261113.h6QBD7qw1392177@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:13:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] destructor for assign2 (fwd)
Status: O
X-UID: 254
Content-Length: 1205
X-Keywords: $NotJunk                                                                                           

>I did as you told me regarding the little issue of the delete command.  I created a copy constructor, and I tried running my script and I get a debug error when I try to debug my program.  My copy constructor is as follows:
>String::String(const String& other){
>	ptr=other.ptr;
>}
> where ptr is a char* and is the only private member.  For my destructor I have:
>String::~String(){
>	delete[] ptr;
>}
>where anything being pointed at by ptr would be deleted.  Why is it that I am having problems running my script when it comes time for the destructor.  When I comment out the implementation of my destructor, it works fine, but else otherwise.  My script is this:
> ...deleted...
>
>Can you help me as far as why I'm getting this error while running and debugging.  Thanks a lot.

Well, take a very close look at the copy constructor you have.
What have you done differently in it than what the compiler would
have done if you did not write it?

By the way, it is not a script, it is code. Generally a script is
interpreted, code is compiled.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-259-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:19:51 2003
Return-Path: <uhcosc1320-return-259-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QBJp5Z1405576
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:19:51 -0500 (CDT)
Received: (qmail 7283 invoked by uid 108); 26 Jul 2003 11:24:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 782 invoked from network); 26 Jul 2003 11:14:49 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261110.h6QBAOLw1387106@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:10:24 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Declaration and implementation of OutOfRange (fwd)
Status: O
X-UID: 255
Content-Length: 423
X-Keywords: $NotJunk                                                                                           

>So, if I am not mistaken, we should declare class OutOfRange in our String.h 
>header file.  Where should we implement it?  I am not too familiar with the 
>standard coding conventions for exception handling.
>
>Thanks,

Implementation should go in the .cpp file.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-260-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:26:20 2003
Return-Path: <uhcosc1320-return-260-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QBQJ5Z1424068
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:26:20 -0500 (CDT)
Received: (qmail 11700 invoked by uid 108); 26 Jul 2003 11:30:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4479 invoked from network); 26 Jul 2003 11:20:39 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261116.h6QBGD3u1401094@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:16:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubt Regarding Homework-2 (Just A Small Clarification) (fwd)
Status: O
X-UID: 256
Content-Length: 609
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> 
>Sorry for asking a doubt on homework-2 now.In question-2 of homework-2, i think 
>name, brain and birthdate "should" be placed in the initialization list.And coming to income and pCar, both are optional as they can be placed either in initialization list or in the body of Person's constructor.Hope i am correct.Could you please clarify.
> 
>Thanks and Regards.

I think the placement of each of this you have mentioned is correct.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-261-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:27:36 2003
Return-Path: <uhcosc1320-return-261-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QBRa5Z1422333
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:27:36 -0500 (CDT)
Received: (qmail 12850 invoked by uid 108); 26 Jul 2003 11:31:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3416 invoked from network); 26 Jul 2003 11:19:06 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261114.h6QBEeUJ1394629@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:14:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] iostream error in assignment 2 (fwd)
Status: O
X-UID: 257
Content-Length: 959
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>While beginning to write assignment 2, I ran the program with a bare skeleton 
>with nothing except only simple function prototyes in String.h, no 
>implementation in String.cpp, and what was provided in assignment 2 to test the 
>interface.  I received many errors that read:  
> 
>    'cout':  ambiguous symbol
>
>I tried to correct the problem by changing 
>
>     #include <iostream.h> in String.h to 
>
>     #include <iostream>
>     using namespace std;
>
>This fixed the problem but I was wondering, would this cause any harm to the 
>rest of the program?  Thanks in advance.

You are saying through out the program consistenly you are using
the iostream from the std library. You are saying you are not mixing
the std with the older iostream.h. That sounds reasonable to me.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-262-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:29:01 2003
Return-Path: <uhcosc1320-return-262-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QBT05Z1432898
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:29:00 -0500 (CDT)
Received: (qmail 13887 invoked by uid 108); 26 Jul 2003 11:33:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9486 invoked from network); 26 Jul 2003 11:27:18 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261122.h6QBMqjW1410003@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:22:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assignment 2: OutOfRange scope resolution and cout problem (fwd)
Status: O
X-UID: 258
Content-Length: 3268
X-Keywords: $NotJunk                                                                                           

><P>Hi Venkat</P>
><P>But this change in main.cpp should not make any difference. My program works fine with both main. </P>
><P>Should it make any difference?</P>

If you recollect, I had mentioned that the correctness of output
depends on which compiler you are using and on which OS you are on.

Use the modified version of assing2.cpp posted if you want to 
be consistent with the one I will be using.

><DIV></DIV>&gt;From: "Dr. Venkat Subramaniam" <COSC155G@BAYOU.UH.EDU>
><DIV></DIV>&gt;To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List) 
><DIV></DIV>&gt;Subject: [uhcosc1320] Assignment 2: OutOfRange scope resolution and cout problem (fwd) 
><DIV></DIV>&gt;Date: Fri, 25 Jul 2003 06:38:27 -0500 (CDT) 
><DIV></DIV>&gt; 
><DIV></DIV>&gt; &gt;You have in the requirements: 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;// o Accessing a character out of the range of characters will throw an 
><DIV></DIV>&gt; &gt;// exception String::OutOfRange. The OutOfRange supports a method... 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;If I write the OutOfRange class interface inside of the String class 
><DIV></DIV>&gt; &gt;interface then I fail to compile because in the assign2.cpp file it 
><DIV></DIV>&gt; &gt;needs "catch(String::OutOfRange&amp; exceptionObj)" instead of how its 
><DIV></DIV>&gt; &gt;written "catch(OutOfRange&amp; exceptionObj)". If I define the OutOfRange 
><DIV></DIV>&gt; &gt;class interface outside of the String class interface then it works 
><DIV></DIV>&gt; &gt;fine. Is there something we are suppose to do with namespaces to fix 
><DIV></DIV>&gt; &gt;this, or are we just suppose the define the OutOfRange class outside of 
><DIV></DIV>&gt; &gt;the String class? 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;Define it outside the class. 
><DIV></DIV>&gt; 
><DIV></DIV>&gt; &gt;Also, I am having the same problem a couple others wrote about. I am 
><DIV></DIV>&gt; &gt;getting in my output: 
><DIV></DIV>&gt; &gt;"Access attempt position 19 on string of size 13" instead of "20th char 
><DIV></DIV>&gt; &gt;in the string is Access attempt position 19 on string of size 13". 
><DIV></DIV>&gt; &gt;I am using Bloodshed Dev-C++ which uses the Mingw compiler. Other than 
><DIV></DIV>&gt; &gt;those two things everything is running fine, thanks for the help. 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;This was addressed in the previous email this morning. 
><DIV></DIV>&gt;I have modified the assign2.cpp to this effect. You may want to 
><DIV></DIV>&gt;get a new copy of the assign2.cpp file or make this one change to 
><DIV></DIV>&gt;the copy you have: 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;cout &lt;&lt; "20th char in the string is " 
><DIV></DIV>&gt; &lt;&lt; stringObj[19] &lt;&lt; endl; 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;to 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;cout &lt;&lt; "20th char in the string is "; 
><DIV></DIV>&gt;cout &lt;&lt; stringObj[19] &lt;&lt; endl; 
><DIV></DIV>&gt;Venkat Subramaniam 
><DIV></DIV>&gt;-- 
><DIV></DIV>&gt;cosc155g@bayou.uh.edu Department of Computer Science 
><DIV></DIV>&gt;http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475 



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-263-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:30:44 2003
Return-Path: <uhcosc1320-return-263-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QBUi5Z1436051
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:30:44 -0500 (CDT)
Received: (qmail 15110 invoked by uid 108); 26 Jul 2003 11:34:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13521 invoked from network); 26 Jul 2003 11:32:49 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261128.h6QBSNZW1430335@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:28:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problem or Question with Assign2 (fwd)
Status: O
X-UID: 259
Content-Length: 1049
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
> 
>I am having a strange occurrence with my program when I let the default destructor work my program works fine which is weird because I have a private pionter in my class String, which would need to be deleted off the heap but when I attemp to delete it my program aborts. Here is my code if you could please look at why this may be occurring. thanx
> 

Hold it right there.

In your operator+ you have
1.  String temp= *this;
2.  strcat(temp.theString, otherString.theString);
3.  return temp;

Let's assume we have

String s1 = "hello";
String s2 = "there";

In line 1 (above), you have temp with a character array of size 6 
(5 chars of hello plus the delimiter).

In line 2, you just threw in five more characters on it. Where is
the space to hold these extra characters?

>I was also hoping if you could give a hint on how I am suppose to get this
>statement to work  greet[1] = 'i'; it seems to be giving me alot of trouble thanx again

This was discussed in an earlier email sent out this morning. Please
refer to that.

Venkat

From uhcosc1320-return-264-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 06:37:06 2003
Return-Path: <uhcosc1320-return-264-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QBb55Z1452141
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 06:37:06 -0500 (CDT)
Received: (qmail 19107 invoked by uid 108); 26 Jul 2003 11:41:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7580 invoked from network); 26 Jul 2003 11:24:18 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261119.h6QBJqr81402901@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 06:19:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubt Regarding Exception Example (fwd)
Status: O
X-UID: 260
Content-Length: 2168
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> 
>I have a doubt regarding "ExceptionAndCopyConstruction" example done in class.
> 
>Code:
> 
>#include <iostream>
>using namespace std;
>class X
>{
>public:
> X() { cout << "X()" << endl; }
> X(const X&) { cout << "X(const X&)" << endl; }
> const X& operator=(const X&)
> {
>  cout << "operator=" << endl;
>  return *this;
> }
> ~X() { cout << "~X()" << endl; }
>};
>void f1()
>{
> cout << "In f1" << endl;
> throw X();
>}
>void main()
>{
> try
> {
>  f1();
> }
> catch(X obj)
> {
>  cout << "In first catch" << endl;
> }
> try
> {
>  f1();
> }
> catch(X& obj)
> {
>  cout << "In second catch" << endl;
> }
>}
> 
>In the output of the above code,after the "In first catch" is displayed two destructors(~X()) are displayed.When i was debugging the code i noticed that before the first catch block ends, the destructor is called once and first "~X()" gets displayed.And then the catch block is exited and the second "~X()" gets displayed.But for the second "~X()" message,the destructor is not called.Could you explain why the destructor was called only once and also how do we know which destructor output of the two is that of the original object and which output is that of the copy.Your answers help us very much.
> 
>Sorry if the answer is too trivial.
> 
>Thanks and Regards.

In the first catch, a copy of the exception is made. So, the exception
object that is thrown waits until a copy can be made and it dies
right after that. The copy that is made dies after the catch executes.

In the case of the second one, no copy is made at all. It is caught
by reference (just like call by reference). So, there is no overhead
of copy construction and destruction. 

If you want to know which is being destroyed, do the following.

Put a break point in the constructor, copy constructor and destructor.
Run the program and when it steps into each of these, not down the 
value of the this pointer on a paper. Compare these and you will know
the order in which these are created and destroyed.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-265-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 09:51:21 2003
Return-Path: <uhcosc1320-return-265-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QEpK5Z1413436
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 09:51:20 -0500 (CDT)
Received: (qmail 14621 invoked by uid 108); 26 Jul 2003 14:55:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13906 invoked from network); 26 Jul 2003 14:54:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261450.h6QEoFYn1410113@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 09:50:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] I don't understand (fwd)
Status: O
X-UID: 261
Content-Length: 1571
X-Keywords: $NotJunk                                                                                           

>Maybe it's just me, I don't know.  I understand the concepts in 
>class, but when I try to replicate what you've done in class for 
>the assignments and homework, I just don't understand how to.  
>Maybe it's just that there is so much information and so much to 
>learn in such a short amount of time, that I don't get it.  I feel 
>that this class is too fast paced for the concepts that we cover, 
>and I feel that I've wasted $500 for a class that I'm not going 
>pass, even with a C.  What, if any, recommendations can you 
>offer?  I'm over 3/4 the way through the Sams Teach Yourself C++ 
>in 24 Hours, and I understand the concepts in there too, but 
>again, the implementation of the concepts is beyond me.  I've read 
>portions of the How To Program C++ book that is required, but the 
>same thing there too.  Is there any help for me? 

Very sorry to hear that you consider this to be waste of your money.

Taking such a difficult class in summer is not that every one can
handle. Please note that I am saying this without knowing who you
are. So, I am not mentioning any thing specific about you.

I have tried to answer each and every question that is asked in class
and outside. I have spent significant amount of time after class 
talking to students. I think I am doing all I can to help you get
this through. So, it is my turn to ask, what more can I do?

Any comments from others in the class?

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-266-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 10:16:04 2003
Return-Path: <uhcosc1320-return-266-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QFG35Z1477488
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 10:16:04 -0500 (CDT)
Received: (qmail 32178 invoked by uid 108); 26 Jul 2003 15:20:19 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30957 invoked from network); 26 Jul 2003 15:18:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261514.h6QFEXop1473022@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 10:14:33 -0500 (CDT)
Cc: mzhang3@bayou.uh.edu, jqchen@cs.uh.edu
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] I don't understand (fwd)
Status: O
X-UID: 262
Content-Length: 1082
X-Keywords: $NotJunk                                                                                           

>I think that we've learned more from you in this short period of time, than we 
>would during the semester with the other proffessors that teach this course.  
>It is very hard trying to understand everything though, in such a short period 
>of time.  And implementing what we've learned in the assignments is very 
>difficult at times because one day we learn it and the next we're trying to 
>use it in our program without really understanding it very well sometimes.  
>Having someone around the lab while we're working on our assingments would be 
>great!

This is a very good suggestion. I am forwarding this email to the
TAs of the course to see if their schedule will allow them to
be present for some additional time during the next two weeks.

Jin and Meizhuo, if your schedule will allow you to be present
in the lab to guide the students a bit more, please let me know
the hours and I will send it to the class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-267-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 10:38:08 2003
Return-Path: <uhcosc1320-return-267-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QFc85Z1530367
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 10:38:08 -0500 (CDT)
Received: (qmail 14746 invoked by uid 108); 26 Jul 2003 15:42:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14484 invoked from network); 26 Jul 2003 15:42:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261537.h6QFbZA91531040@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 10:37:35 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] I don't understand (fwd)
Status: O
X-UID: 263
Content-Length: 2010
X-Keywords: $NotJunk                                                                                           

>I don't doubt that we are learning more from Venkat than if we 
>were to take it from another professor.  But with this suggestion 
>below, there is a problem.  This class doesn't offer lab time.  At 
>least, not from what I've seen.  It would have been great to know 
>that there was a lab offered, if there was one.  So, with that 
>said, when and where does this non-existant, yet existant lab 
>meet?  Please advise.

There is no dedicated lab or lab time for this course.
I will let you know if, when, and where you can meet the 
TAs upon hearing from them.

Venkat

>
>>I think that we've learned more from you in this short period of 
>time, 
>>than we
>>would during the semester with the other proffessors that teach 
>this course.  
>>It is very hard trying to understand everything though, in such a 
>short period 
>>of time.  And implementing what we've learned in the assignments 
>is very 
>>difficult at times because one day we learn it and the next we're 
>trying to 
>>use it in our program without really understanding it very well 
>sometimes.  
>>Having someone around the lab while we're working on our 
>assingments would be 
>>great!
>
>This is a very good suggestion. I am forwarding this email to the 
>TAs of the course to see if their schedule will allow them to be 
>present for some additional time during the next two weeks.
>
>Jin and Meizhuo, if your schedule will allow you to be present in 
>the lab to guide the students a bit more, please let me know the 
>hours and I will send it to the class.
>
>Venkat Subramaniam
>--				
>cosc155g@bayou.uh.edu		Department of Computer Science
>http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 
>77204-3475
> 
>
>________________________________________________________________
>Sent via the EV1 webmail system at mail.ev1.net
>
>
> 
>                   
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-268-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 11:10:13 2003
Return-Path: <uhcosc1320-return-268-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QGAD5Z1087600
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 11:10:13 -0500 (CDT)
Received: (qmail 4652 invoked by uid 108); 26 Jul 2003 16:14:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4329 invoked from network); 26 Jul 2003 16:14:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261609.h6QG9kHF1512930@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 11:09:46 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] How would I implement constructor of Person in HW2
Status: O
X-UID: 264
Content-Length: 1317
X-Keywords: $NotJunk                                                                                           

1. Here is what I would do for the constructor of Person in HW2:

Person(const char* rName, long dateOfBirth, int iq, int rIncome)
: name(rName), brain(iq), birthdate(dateOfBirth)
{
	pCar = new Car(); // Or pCar = 0;
	income = rIncome;
}

2. Why I would use the initialization list for each member on the 
	initialization list

Since String and Brain do not have a constructor that takes no 
arguement, I am forced to initialize these in the initialization
list. Further, initializing objects in the initialization list
is more efficient than assigning them values in the constructor,
since assignning them in the constructor requires additional
method call.

I have to initialize the birthdate here as well since it is a
const and it can not be assigned a value within the constructor.

3. why I am not using the initialization list for each
 member not on the initialization list

pCar is just a pointer. If I do not initialize it, there is no
overhead. I will imply assign it a value in the constructor to
either a Car pointer or simply to null (0). Similarly,
not initializing income has no overhead and I will assign 
it a value in the constructor. 

While I could put these two in the initialization list, putting
them in the constructor improves readability of code and so I
choose to do it that way.

Venkat 

From uhcosc1320-return-269-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 13:17:57 2003
Return-Path: <uhcosc1320-return-269-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QIHv5Z1407889
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 13:17:57 -0500 (CDT)
Received: (qmail 24101 invoked by uid 108); 26 Jul 2003 18:22:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23601 invoked from network); 26 Jul 2003 18:21:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261817.h6QIH35P1406672@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 13:17:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Dropping Class (fwd)
Status: O
X-UID: 265
Content-Length: 773
X-Keywords: $NotJunk                                                                                           

>Dr. Subramaniam,
>
>I would like to drop the class as of today.  I can bring the form by to
>you Monday or Tuesday either before or after class.  What is the best
>way to do this?

Please bring the form and get my signature. Best time for that is
either before or after the class. Generally, in all my courses, any student 
dropping the course before the University set deadline will get a WP 
(withdraw with pass).

I see that Tuesday July 29th is the last day to drop the course. Since I
am not on campus during the day, the best bet is to get it signed by me 
on Monday.

Wish you all the best in your efforts.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-270-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 13:23:48 2003
Return-Path: <uhcosc1320-return-270-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QINl5Z1416063
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 13:23:47 -0500 (CDT)
Received: (qmail 27890 invoked by uid 108); 26 Jul 2003 18:28:09 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26662 invoked from network); 26 Jul 2003 18:26:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261821.h6QILrfW1418630@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 13:21:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Errors with #include files (fwd)
Status: O
X-UID: 266
Content-Length: 1033
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>I'm having trouble understanding which library files to include.
>I have these lines in my String.cpp file:
>
>#include <stdio.h>
>#include <string.h>
>#include <iostream.h>
>
>When I compile my code, I get 13 errors saying the same thing:
>
>cout : ambiguous symbol

Do not use iostream.h. Use iostream as shown below.  

#include <iostream>
using namespace std;

Also, you need

#include "String.h" in your String.cpp.

>I tried taking out the #include <iostream.h> line but that creates more errors:
>
>'<<' : missing storage-class or type specifiers
>'operator <<' has no formal parameters
>'cout' : undeclared identifier
>... and so on
>
>The only way I found to fix this was to take out #include <iostream> and using namespace std in the assign2.cpp, but leaving my original three include files in the String.cpp.  What am I doing wrong?  
>
>Thank you.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-271-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 13:24:03 2003
Return-Path: <uhcosc1320-return-271-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QIO35Z1419888
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 13:24:03 -0500 (CDT)
Received: (qmail 28182 invoked by uid 108); 26 Jul 2003 18:28:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24761 invoked from network); 26 Jul 2003 18:23:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261818.h6QIIhi91404503@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 13:18:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assingment2 (fwd)
Status: O
X-UID: 267
Content-Length: 1286
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>          Thanks for fixing my problem for me. Now my program runs with no error message at the end! Thanks again!!
> 

You are most welcome!

Venkat
 
> 
>>Hello Venkat,
>> When I run my program, it runs fine but a box pops up and tells me there is a bug on the heap (not in these words exactly) after running it. 
>
>How lucky, you get special messages!
>
>>I have debugged it and could not find anything. I know it has to do with the deletion of char arrays but I can't find it. Can you help please? Here is my code:
>
>>... code deleted...
>>
>>I would really appreciate it. Thanks.
>>
>
>Couple of troubling things in the code:
>
>1. never call strlen on a char* without checking if that is zero.
>
>size = strlen(pInput);
>
>should be 
>if (pInput != 0)
>{
>size = strlen(pInput);
>}
>
>2. p = new char[0];
>
>You have created a array of 0 characters. To store the empty
>string, you need
>
>p = new char[1];
>*p = '\0';
>
>Finally one more thing. There is absolutely no reason to keep a separate 
>member to know the length of the string. At any time, you can call strlen
>on your char* member and find out.
>
>Venkat Subramaniam
>-- 
>cosc155g@bayou.uh.edu Department of Computer Science
>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-272-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 13:26:28 2003
Return-Path: <uhcosc1320-return-272-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QIQS5Z1404300
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 13:26:28 -0500 (CDT)
Received: (qmail 29807 invoked by uid 108); 26 Jul 2003 18:30:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25590 invoked from network); 26 Jul 2003 18:24:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261820.h6QIK4YS1411110@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 13:20:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] error with using namespace std (fwd)
Status: O
X-UID: 268
Content-Length: 522
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> 
>       When I compile my program, an error occors: error c2871, 'std': does not exist or is not a namespace. Could you please tell me what is wrong with my program?? Thanks!
> 

Make sure you have #include <iostream> and not #include<iostream.h>.
If that does not fix it, I have no idea. If you email me your code
I may be able to help further.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-273-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 13:44:39 2003
Return-Path: <uhcosc1320-return-273-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QIic5Z1414813
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 13:44:38 -0500 (CDT)
Received: (qmail 8417 invoked by uid 108); 26 Jul 2003 18:49:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8173 invoked from network); 26 Jul 2003 18:48:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261843.h6QIhxI11469041@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 13:43:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] error with using namespace std (fwd)
Status: O
X-UID: 269
Content-Length: 1218
X-Keywords: $NotJunk                                                                                           

>Thanks! It works!!!

We are making progress.

>But I have another problem in my program, I have no errors and no warnnings. When I run it, a pop up window says Debug error ! .....abnormal program termination. 
>I don't know what is worng? Do you know that?? Thanks!
>

A couplo of emails sent out this morning deal with similar errors.
Take a look at those emails. Then put break point in your destructor
and run the program to see where it is failing. You can look at
the call stack to figure out where the destructor is being called
and you can also examine the object details to get an idea. Hopefully
this will show you where the problem is.

Venkat

>
>
>"Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU> wrote:
>>Hello Venkat,
>> 
>> When I compile my program, an error occors: error c2871, 'std': does not exist or is not a namespace. Could you please tell me what is wrong with my program?? Thanks!
>> 
>
>Make sure you have #include and not #include.
>If that does not fix it, I have no idea. If you email me your code
>I may be able to help further.
>
>Venkat Subramaniam
>-- 
>cosc155g@bayou.uh.edu Department of Computer Science
>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-274-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 13:49:56 2003
Return-Path: <uhcosc1320-return-274-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QInt5Z1485557
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 13:49:55 -0500 (CDT)
Received: (qmail 11855 invoked by uid 108); 26 Jul 2003 18:54:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10274 invoked from network); 26 Jul 2003 18:51:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261847.h6QIl4Q81159361@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 13:47:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Constructor with no arguments -- Assignment 2 (fwd)
Status: O
X-UID: 270
Content-Length: 547
X-Keywords: $NotJunk                                                                                           

>I see that a Constructor with no arguments is going to have to be called, but I'm not sure what it's going to do.   The string that is going to be passed to the constructor with no arguments is what we are going to input, correct?  So I'm a little confused as to what I should do.  Please help

This should set the char* to an empty string, one that simply has
a '\0' or "" as the value.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-275-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 14:13:29 2003
Return-Path: <uhcosc1320-return-275-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QJDS5Z1541995
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 14:13:28 -0500 (CDT)
Received: (qmail 26224 invoked by uid 108); 26 Jul 2003 19:17:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25035 invoked from network); 26 Jul 2003 19:15:52 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261911.h6QJBO6q1542825@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 14:11:24 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Constructor with no arguments -- Assignment 2 (fwd)
Status: O
X-UID: 271
Content-Length: 2638
X-Keywords: $NotJunk                                                                                           

>Oh ok, so if we are setting the char* to an empty string with a '\0' we also need to allocate memory on the heap for this here as well correct?  For example..
> 
>... deleted... 
>should work?

You got it.

Actually, all you need is an array of size 1 in this case.

Venkat

>"Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU> wrote:
>>I see that a Constructor with no arguments is going to have to be called, but I'm not sure what it's going to do. The string that is going to be passed to the constructor with no arguments is what we are going to input, correct? So I'm a little confused as to what I should do. Please help
>
>This should set the char* to an empty string, one that simply has
>a '\0' or "" as the value.
>
>Venkat Subramaniam
>-- 
>cosc155g@bayou.uh.edu Department of Computer Science
>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>--0-1922225320-1059246049=:18715
>Content-Type: text/html; charset=us-ascii
>
><DIV>Oh ok, so if we are setting the char* to an empty string with a '\0' we also need to allocate memory on the heap for this here as well correct?&nbsp; For example..</DIV>
><DIV>&nbsp;</DIV>
><DIV>String::String()</DIV>
><DIV>{</DIV>
><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; str=new char[2];</DIV>
><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; str='/0';</DIV>
><DIV>}</DIV>
><DIV>&nbsp;</DIV>
><DIV>should work?<BR><BR><B><I>"Dr. Venkat Subramaniam" &lt;cosc155g@Bayou.UH.EDU&gt;</I></B> wrote:</DIV>
><DIV>
><BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid; WIDTH: 100%">&gt;I see that a Constructor with no arguments is going to have to be called, but I'm not sure what it's going to do. The string that is going to be passed to the constructor with no arguments is what we are going to input, correct? So I'm a little confused as to what I should do. Please help<BR><BR>This should set the char* to an empty string, one that simply has<BR>a '\0' or "" as the value.<BR><BR>Venkat Subramaniam<BR>-- <BR>cosc155g@bayou.uh.edu Department of Computer Science<BR>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475</BLOCKQUOTE></DIV><p><hr SIZE=1>
>Do you Yahoo!?<br>
><a href="http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com">Yahoo! SiteBuilder</a> - Free, easy-to-use web site design software
>--0-1922225320-1059246049=:18715--
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-276-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 14:20:42 2003
Return-Path: <uhcosc1320-return-276-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QJKg5Z1567013
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 14:20:42 -0500 (CDT)
Received: (qmail 30574 invoked by uid 108); 26 Jul 2003 19:24:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26130 invoked from network); 26 Jul 2003 19:17:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261913.h6QJDEBH1548716@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 14:13:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] I don't understand (fwd)
Status: O
X-UID: 272
Content-Length: 1750
X-Keywords: $NotJunk                                                                                           

>Venkat:
>
>I can provide help in the lab on Tuesday from 11:00am to noon.
>Thanks.
>
>Jin

Jin,

Thanks very much for the quick response.

That is one more time for you to utilize the help of Jin in 
addition to his office hours.

Jin, please let us know where you will be at this time -
in the lab PGH 547, or some other lab or in your office location posted 
on the web site.

Regards,

Venkat

>
>On Sat, 26 Jul 2003, Dr. Venkat Subramaniam wrote:
>
>> >I think that we've learned more from you in this short period of time, than we
>> >would during the semester with the other proffessors that teach this course.
>> >It is very hard trying to understand everything though, in such a short period
>> >of time.  And implementing what we've learned in the assignments is very
>> >difficult at times because one day we learn it and the next we're trying to
>> >use it in our program without really understanding it very well sometimes.
>> >Having someone around the lab while we're working on our assingments would be
>> >great!
>>
>> This is a very good suggestion. I am forwarding this email to the
>> TAs of the course to see if their schedule will allow them to
>> be present for some additional time during the next two weeks.
>>
>> Jin and Meizhuo, if your schedule will allow you to be present
>> in the lab to guide the students a bit more, please let me know
>> the hours and I will send it to the class.
>>
>> Venkat Subramaniam
>> --
>> cosc155g@bayou.uh.edu		Department of Computer Science
>> http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475
>>
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-277-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 14:26:52 2003
Return-Path: <uhcosc1320-return-277-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QJQo5Z1050674
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 14:26:51 -0500 (CDT)
Received: (qmail 1939 invoked by uid 108); 26 Jul 2003 19:31:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29217 invoked from network); 26 Jul 2003 19:22:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261918.h6QJI5QJ1559712@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 14:18:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] I don't understand (fwd)
Status: O
X-UID: 273
Content-Length: 2105
X-Keywords: $NotJunk                                                                                           

>Venkat,
>I can certainly relate to the person who feels like they can't apply the
>concepts that they learned in class.  I run into the same thing myself, but
>there's a huge difference between just reading a book on programming and
>actually writing a program yourself from scratch, especially in C++.  But I
>think the solution to this problem is to constantly write programs in which
>you implement what you just learned in the book.  The Deitel and Dietel book
>has code in the book that you can copy into your own programs or that you
>can refer to when you need a little help when you are writing your code from
>scratch.  If you have the CD that came with the book, they have all the
>sample code in electronic form on the CD.  Programming classes like this are
>not like the rest of the classes you take in college.  You can't just read
>the book and expect to get an A.  You have to actually do it yourself, which
>requires more time beyond reading the book.  Because this is a summer
>semester, that makes the course that much harder.
>
>It would be a huge help to have a lab session with this class.  I don't know
>why they don't require a lab session.  Of all the courses I've taken at UH,
>this one is the one that I think could benefit the most from a lab.
>
>However, with the absence of a lab, I think you are going above and beyond
>the call of duty to provide all the help we need.  Thanks so much for your
>dedication.

There are two things you have mentioned that are important.

First, for the students, it is imporant to realize that this comes with
practise. The more programs you write, the more you understand it.
I can not emphasize that enough.

I have been teaching this course at various levels over the past 11 years.
This is the first time I am teaching it at the freshman level. One thing
that I realize with this is that a lab with this course will be useful.
Second thing from your email is the emphasis for a lab and I hope we can
accomodate that in the future.

I will propose to the department to make this 1420 (like 1410) and have a 
lab with it.

Regards,

Venkat

From uhcosc1320-return-278-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Jul 26 14:31:20 2003
Return-Path: <uhcosc1320-return-278-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6QJVJ5Z1067368
	for <cosc155g@bayou.uh.edu>; Sat, 26 Jul 2003 14:31:20 -0500 (CDT)
Received: (qmail 4892 invoked by uid 108); 26 Jul 2003 19:35:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3689 invoked from network); 26 Jul 2003 19:33:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307261929.h6QJTTg31060958@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 26 Jul 2003 14:29:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] error with using namespace std (fwd)
Status: O
X-UID: 274
Content-Length: 5006
X-Keywords: $NotJunk                                                                                           

>When I debug my program, I got this errors:
>Loaded 'ntdll.dll', no matching symbolic information found.
>Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
>First-chance exception in stringproj.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
>First-chance exception in stringproj.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
>The thread 0x2E0 has exited with code 1245036 (0x12FF6C).
>do you know what is worng?? Thanks again!

I suggest that you move the break point ahead of the place where this
expection is thrown and get an understanding of what may cause this.
It smells like you are deleting some memory that your process does not
own. Look closely to make sure you have created the charater array
on the heap and you have written the copy constructor well.

If you can't figure out, zip and email the project to me and I will
take a look at it and send you some hints.

Venkat

>"Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU> wrote:
>>Thanks! It works!!!
>
>We are making progress.
>
>>But I have another problem in my program, I have no errors and no warnnings. When I run it, a pop up window says Debug error ! .....abnormal program termination. 
>>I don't know what is worng? Do you know that?? Thanks!
>>
>
>A couplo of emails sent out this morning deal with similar errors.
>Take a look at those emails. Then put break point in your destructor
>and run the program to see where it is failing. You can look at
>the call stack to figure out where the destructor is being called
>and you can also examine the object details to get an idea. Hopefully
>this will show you where the problem is.
>
>Venkat
>
>>
>>
>>"Dr. Venkat Subramaniam" wrote:
>>>Hello Venkat,
>>> 
>>> When I compile my program, an error occors: error c2871, 'std': does not exist or is not a namespace. Could you please tell me what is wrong with my program?? Thanks!
>>> 
>>
>>Make sure you have #include and not #include.
>>If that does not fix it, I have no idea. If you email me your code
>>I may be able to help further.
>>
>>Venkat Subramaniam
>>-- 
>>cosc155g@bayou.uh.edu Department of Computer Science
>>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>--0-914690765-1059247240=:48022
>Content-Type: text/html; charset=us-ascii
>
><DIV>When I debug my program, I got this errors:</DIV>
><DIV><FONT color=#ff0000>Loaded 'ntdll.dll', no matching symbolic information found.<BR>Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.<BR>First-chance exception in stringproj.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.<BR>First-chance exception in stringproj.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.<BR>The thread 0x2E0 has exited with code 1245036 (0x12FF6C).</FONT><BR>do you know what is worng?? Thanks again!</DIV>
><DIV>&nbsp;</DIV>
><DIV>Jonathan</DIV>
><DIV>&nbsp;</DIV>
><DIV><BR><B><I>"Dr. Venkat Subramaniam" &lt;cosc155g@Bayou.UH.EDU&gt;</I></B> wrote:</DIV>
><DIV>
><BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid; WIDTH: 100%">&gt;Thanks! It works!!!<BR><BR>We are making progress.<BR><BR>&gt;But I have another problem in my program, I have no errors and no warnnings. When I run it, a pop up window says Debug error ! .....abnormal program termination. <BR>&gt;I don't know what is worng? Do you know that?? Thanks!<BR>&gt;<BR><BR>A couplo of emails sent out this morning deal with similar errors.<BR>Take a look at those emails. Then put break point in your destructor<BR>and run the program to see where it is failing. You can look at<BR>the call stack to figure out where the destructor is being called<BR>and you can also examine the object details to get an idea. Hopefully<BR>this will show you where the problem is.<BR><BR>Venkat<BR><BR>&gt;<BR>&gt;<BR>&gt;"Dr. Venkat Subramaniam" <COSC155G@BAYOU.UH.EDU>wrote:<BR>&gt;&gt;Hello Venkat,<BR>&gt;&gt; <BR>&gt;&gt; When I compile my program, an error occors:!
  error
> c2871, 'std': does not exist or is not a namespace. Could you please tell me what is wrong with my program?? Thanks!<BR>&gt;&gt; <BR>&gt;<BR>&gt;Make sure you have #include and not #include.<BR>&gt;If that does not fix it, I have no idea. If you email me your code<BR>&gt;I may be able to help further.<BR>&gt;<BR>&gt;Venkat Subramaniam<BR>&gt;-- <BR>&gt;cosc155g@bayou.uh.edu Department of Computer Science<BR>&gt;http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475</BLOCKQUOTE></DIV><p><hr SIZE=1>
>Do you Yahoo!?<br>
><a href="http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com">Yahoo! SiteBuilder</a> - Free, easy-to-use web site design software
>--0-914690765-1059247240=:48022--
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-279-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:16:43 2003
Return-Path: <uhcosc1320-return-279-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9Ge5Z1312661
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:16:40 -0500 (CDT)
Received: (qmail 32659 invoked by uid 108); 27 Jul 2003 09:21:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31198 invoked from network); 27 Jul 2003 09:19:05 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270911.h6R9Btxl1308675@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:11:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Question about String constructor and pointer (fwd)
Status: O
X-UID: 275
Content-Length: 1158
X-Keywords: $NotJunk                                                                                           

><P>Hi Venkat,</P>
><P>Would setting the pointer to 0 be okay. </P>
><P>This what I did in my constructor, </P>
><P>in the class String.h</P>
><P>constructor is declared as :</P>
>...deleted...
><P>Implementations is:</P>
>...deleted...
><P>with out setting pString=0, wouldn't you get a segmentation fault. Especially at the end of program where there is an object eString of type String with no argument and we are trying to check if it is empty or not. </P>

You will not get a segementation fault since in my earlier suggestion, you are indeed allocating
memory on the heap and setting that to "" or '\0'. So, at the end, it will go through proper
cleanup.

><P>And I asked you before I couldn't find the answer in the email that shouldn't the changed main and the main before give the same result.</P>
><P>Thanks</P>

The changed main and the main before do not give the same results on all compilers. That is the
reason for the change to be consistent irrespective of the system you are using.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-280-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:20:30 2003
Return-Path: <uhcosc1320-return-280-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9KT5Z1314070
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:20:29 -0500 (CDT)
Received: (qmail 2862 invoked by uid 108); 27 Jul 2003 09:24:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 788 invoked from network); 27 Jul 2003 09:21:39 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270917.h6R9H9am1311107@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:17:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] getError question (fwd)
Status: O
X-UID: 276
Content-Length: 855
X-Keywords: $NotJunk                                                                                           

>We define class OutOfRange outside of class String, but does getError get defined inside of OutOfRange?  
>It's a method of that class, correct?  So  can we define it as a public in that class?  

>From the code within the catch block, we can see that getError is being invoked on the
exception object. This tells us that the getError is a public method of the OutOfRange class.

>Also, does the implementation for it get done in the String.h file (when it's defined in the public 
>section of class OutOfRange) or does the method go on our .cpp file with the rest of the methods that 
>class String is using.  I'm a little confused?  

I would prefer to put the implementation in the .cpp file.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-281-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:26:56 2003
Return-Path: <uhcosc1320-return-281-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9Qr5Z1322560
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:26:53 -0500 (CDT)
Received: (qmail 6943 invoked by uid 108); 27 Jul 2003 09:31:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2063 invoked from network); 27 Jul 2003 09:23:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270919.h6R9J4361318059@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:19:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] IMPORTANT.... commenting
Status: O
X-UID: 277
Content-Length: 388
X-Keywords: $NotJunk                                                                                           

Folks,

Please remember to document your code properly. This was one of the major reasons why
people lost points in Assignment 1. 

Please visit the following URL for more details:

http://www.cs.uh.edu/~svenkat/C++CodingStandard

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-282-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:29:34 2003
Return-Path: <uhcosc1320-return-282-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9TV5Z1323902
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:29:31 -0500 (CDT)
Received: (qmail 8725 invoked by uid 108); 27 Jul 2003 09:33:55 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5152 invoked from network); 27 Jul 2003 09:28:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270923.h6R9NxU21323246@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:23:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] destructor for assign2 (fwd)
Status: O
X-UID: 278
Content-Length: 2826
X-Keywords: $NotJunk                                                                                           

>What I have done differently with my copy constructor:
>String::String(const String& other){
>	ptr=0;
>	if (other.ptr!=0){
>		ptr= new char[strlen(other.ptr) + 1];
>	    strcpy(ptr,other.ptr);}
>
>is that for the copy created ptr points to a new array on the heap, while the String object passed by value 
>points to another.  I guess the compiler would have both ptr pointing to the same thing. 

In the above code you have shown, you are making a deep copy. This is different from the one
you had emailed earlier which was performing shallow copy as you have described above.
The above code for the copy constructor is what you want to work with. 

>I tried altering the copy constructor to :
>String::String(const String& other){
>	ptr=0;
>        ptr=other.ptr;}

If you alter it to this, you are making a shallow copy and the result will be trouble when it
comes to deleting the object.

>
>and even the following:
>
>String::String(const String& other){
>	ptr=0;
>        strcpy(ptr,other.ptr);}

This is even worse. You are copying stuff into area of memory that is not allocated (0).

>but I get the same error.  Am I missing something?  Thanks again.

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 07/26/03 06:13 AM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] destructor for assign2 (fwd)
>
>> 
>> >I did as you told me regarding the little issue of the delete command.  I
>created a copy constructor, and I tried running my script and I get a debug 
>error when I try to debug my program.  My copy constructor is as follows:
>>String::String(const String& other){
>>   	ptr=other.ptr;
>>}
>> where ptr is a char* and is the only private member.  For my destructor
>I have:
>>String::~String(){
>>   	delete[] ptr;
>>}
>>where anything being pointed at by ptr would be deleted.  Why is it that
>I am having problems running my script when it comes time for the
>destructor.  When I comment out the implementation of my destructor, it works fine,
>but else otherwise.  My script is this:
>> ...deleted...
>>
>>Can you help me as far as why I'm getting this error while running and
>debugging.  Thanks a lot.
>
>Well, take a very close look at the copy constructor you have.
>What have you done differently in it than what the compiler would
>have done if you did not write it?
>
>By the way, it is not a script, it is code. Generally a script is
>interpreted, code is compiled.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-283-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:32:15 2003
Return-Path: <uhcosc1320-return-283-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9WD5Z1322478
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:32:13 -0500 (CDT)
Received: (qmail 10636 invoked by uid 108); 27 Jul 2003 09:36:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8906 invoked from network); 27 Jul 2003 09:34:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270929.h6R9TRMt1328111@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:29:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Help Please!!! (fwd)
Status: O
X-UID: 279
Content-Length: 1045
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
> I emailed you earlier about the "greet[1] = i;"  statement in the code.
>I read  you reply but am still having trouble figuring out how after I overload the [] operator that i will be able to go back change the [1] place in the string.
> 
>my heading looks like this "char operator [] (int i) const;" this method can return the character in the [1] position but if i were to overload the [] operator with another implementation say char operator[] (int i), how would i be able to actually change the
>[1] position to from what ever letter to 'i'. Is the assignment operator a part of this if so please let me know.  Please help I stuck i've been stuck for a long time! thanx again.
 
Do not return a value. Instead return a reference to the char.
The const method should return a const reference to char. 
The non-const method should return a (non-const) reference to char.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-284-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:37:44 2003
Return-Path: <uhcosc1320-return-284-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9bc5Z1332137
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:37:39 -0500 (CDT)
Received: (qmail 14519 invoked by uid 108); 27 Jul 2003 09:41:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7538 invoked from network); 27 Jul 2003 09:32:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270927.h6R9RTE01325608@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:27:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] example from class (fwd)
Status: O
X-UID: 280
Content-Length: 1375
X-Keywords: $NotJunk                                                                                           

>Venkat,
>Consider the following program written in class
>
>#include <iostream>
>using namespace std;
>
>class X
>{
>public:
>	X() {cout <<"X()"<<endl;}
>	//X(const X&){cout<<"X(const X&)"<<endl;
>	//const X& operator=(const X&)
>	//{
>	//	cout<<"operator="<<endl;
>	//	return *this;
>	//}
>	~X(){cout<<"~X()"<<endl;}
>};
>
>void f1()
>{
>	cout <<"In f1"<<endl;
>	throw X();
>}
>
>
>void main()
>{
>	try
>	{
>		f1();
>	}
>	catch(X& obj)
>	{
>		cout << "In first caught X" << endl;
>		
>		
>	}
>}  <-----
>	
>When I place comments on those lines in "public", the
>program compiled and ran ok.  But if I take out the
>comments.  The compiler gave me error:  "unexpected
>end of file found executed in C1.exe", and the error
>point to the end of main() as I indicated.  My
>questions:
>
>1.  Why that gives error.

You are missing a } at the end of the first line you have in issue:
	X(const X&){cout<<"X(const X&)"<<endl;

>2.  When I take out comments, and place more code in
>the main(), it gives no error and runs well, why?
>
>try
>{
>    f1();
>}
>catch(X& obj)
>{
>    cout << "....."<<<endl;
>}
>
>Thanks

It shouldn't. I am not sure exactly what code change you have put in place.
But the } is what's missing.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-285-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:40:16 2003
Return-Path: <uhcosc1320-return-285-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9eE5Z1335591
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:40:14 -0500 (CDT)
Received: (qmail 16491 invoked by uid 108); 27 Jul 2003 09:44:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14858 invoked from network); 27 Jul 2003 09:42:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270937.h6R9bdvK1334895@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:37:39 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Operartor = (fwd)
Status: O
X-UID: 281
Content-Length: 1002
X-Keywords: $NotJunk                                                                                           

>Venkat, 
>When do you call an operartor function as global or as part of the member class. 

You mean when do we write an operator function as global instead of member?

If the left operand is a built-in type or an object of a class that does not
belong to you (meaning you can not modify that class).

Otherwise, you should implement it as member.

>Also,when you call an operartor = is it the same thing as a copy constuctor. 
>For example:  "obj1=obj2;", would this call a operator =  or a copy constructor. 

int a = 4; // a is being initialized (being constructed)

a = 5; // a is being assigned to

Similarly in the case of objects

X obj1 = obj2; // obj1 is being initialized (being constructed) using another object of the same type.
		// Copy constructor is called.

obj1 = obj2; // obj1 is being assigned to and operator= is called.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-286-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:41:52 2003
Return-Path: <uhcosc1320-return-286-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9fn5Z1331961
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:41:49 -0500 (CDT)
Received: (qmail 17601 invoked by uid 108); 27 Jul 2003 09:46:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10613 invoked from network); 27 Jul 2003 09:36:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270931.h6R9VxlG1190529@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:31:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] submission question (fwd)
Status: O
X-UID: 282
Content-Length: 442
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>What happens if we would like to submit the assignment again because of changes or if we submit it twice in error??
>Thanks

You can submit as many times as you like (until the deadline of course).

What you submit the latest will be the copy that is kept and used.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-287-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:48:40 2003
Return-Path: <uhcosc1320-return-287-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9mc5Z1331799
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:48:39 -0500 (CDT)
Received: (qmail 22681 invoked by uid 108); 27 Jul 2003 09:52:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18344 invoked from network); 27 Jul 2003 09:46:52 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270942.h6R9gIhc1340652@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:42:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Opinion Regarding The Course (fwd)
Status: O
X-UID: 283
Content-Length: 1406
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>  After going through the e-mails regarding lab and other related things, i agree with you in that we need to 
>write as many programs as we can, taking into consideration the complexity and duration of the course.
>Only then can we learn something as i can say from my experience.It's not easy to master C++ in such a short 
>period.But you have been kind enough in taking the pain to explain even the fundamentals and trying to make 
>sure that everyone in the class are comfortable with the concepts.I agree with others that we get to learn 
>more in this course than almost all of the other courses in regular semester in this department.I wish the 
>department could introduce more such programming courses keeping in mind the real-world demand.
> 
>Thanks and Regards.

The shortness of the semester does put more pressure. 

I have already proposed to the department a couple of things. 

One to teach this course over 7 weeks instead of 5 in summer (not as much better as
in Spring and Fall, but better than a shorter version). And I have suggested introducing
the lab as well. 

Again, one can not over emphasize the need for playing with the code.

Thanks to all who took the time to write their comments and suggestions.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-288-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:51:19 2003
Return-Path: <uhcosc1320-return-288-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9pJ5Z1346262
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:51:19 -0500 (CDT)
Received: (qmail 24889 invoked by uid 108); 27 Jul 2003 09:55:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23659 invoked from network); 27 Jul 2003 09:54:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270949.h6R9nW191342438@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:49:32 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] exception handling difficulties (fwd)
Status: O
X-UID: 284
Content-Length: 941
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I must resort to asking for your assistance because I am at an impass.
>I am receiving a runtime assertion error whenever it is necessary for the program to throw an exception.  
>Actually the exception is thrown and the appropriate message printed, but as soon as the program attempts 
>to leave the PrintString function call, it crashes.  I am including my OutOfRange implementation in this 
>message as well as other relevant code.  Any suggestion or observation would be greatly appreciated.  
>Thank you in advance.
> ...deleted...

Shouldn't getError return a const char* instead of char*?

I do not find any thing wrong in the code snip you have sent.

It should be elsewhere in the code. If you email me your entire code, 
I should be able to look at if further.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-289-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:51:53 2003
Return-Path: <uhcosc1320-return-289-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9pq5Z1346944
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:51:52 -0500 (CDT)
Received: (qmail 25510 invoked by uid 108); 27 Jul 2003 09:56:16 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20152 invoked from network); 27 Jul 2003 09:49:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270945.h6R9j4Js1335712@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:45:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Help me Venkat (fwd)
Status: O
X-UID: 285
Content-Length: 784
X-Keywords: $NotJunk                                                                                           

>Hello Venkat, 
>When I compile my String.cpp file with .net, I get the following errors:
>
>(...deleted...)\assignmen2\String.cpp(3): fatal error C1083: Cannot open include file: 'strings.h': No such file or directory
>
>(...deleted...)\assignmen2\String.cpp(7): error C2511: 'String::String(char *)' : overloaded member function not found in 'String'
>
>below is my String.cpp and String.h, could you pleae help me
>

Two problems. 

strings.h may not be available on the PC.

You may have to change it to string.h.

Second, you do not have a constructor, declared within the class, that takes a const char* as an argument.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-290-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 04:55:38 2003
Return-Path: <uhcosc1320-return-290-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6R9ta5Z1347329
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 04:55:36 -0500 (CDT)
Received: (qmail 28242 invoked by uid 108); 27 Jul 2003 10:00:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12628 invoked from network); 27 Jul 2003 09:39:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270934.h6R9YZS51331937@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:34:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Operator+ Problem (fwd)
Status: O
X-UID: 286
Content-Length: 1114
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>  When I implement my operator+ method, it gives me the error :
>assign2\assign2.cpp(48) : error C2678: binary '+' : no operator defined 
>which takes a left-hand operand of type 'const class String' (or there is no 
>acceptable conversion)
>
>...Now I sat and thought about this for a while and realized that in the 
>main.cpp, hello is a constant string object soI can not modify it...I tried 
>copying the object to another temporary string object and still I get the 
>same error...Where am I going wrong? Here is my most latest modified while I 
>am frustrated code for it:
>String String::operator+(const String& Stringer)
>{
...deleted...
>}
>
>Thanks a miilion.

It does not matter if you make a copy within the operator+ or not.

The way you have written operator+, you can not call it on a const object.

The operator+ should be const method. Take a look at the Complex class we
wrote in class and see how the operator+ is declared.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-291-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 05:00:58 2003
Return-Path: <uhcosc1320-return-291-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RA0s5Z1354558
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 05:00:54 -0500 (CDT)
Received: (qmail 32240 invoked by uid 108); 27 Jul 2003 10:05:19 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30408 invoked from network); 27 Jul 2003 10:02:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270958.h6R9wM6T1348156@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:58:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Fileview files (fwd)
Status: O
X-UID: 287
Content-Length: 1067
X-Keywords: $NotJunk                                                                                           

>Hi Venkta,
>
>I have alot of errors when I build.  When I go into the fileview area of the Microsoft Visual C++ compiler 
>and delete the file String.cpp from the Source Files folder and the String.h from the Header Files folder, 
>all these errors disappear and the code executes fine.  My String.h has #include "String.cpp" at the end of 
>the code.  Is that right?  

No. You should not include the .cpp file from within the .h file. It should be compiled and
linked and not included that way.

>Is it okay to only have Assign2.cpp under the Source Files folder, because that's the only way I can get 
>my program to run.  Or am I doing something wrong?  Thank you.

Remove the #include "String.cpp"

Add the String.h, String.cpp and assign2.cpp to the project. You should see the two .cpp files
in the source files and the .h file in the header files node of the files tree view.

Now, compile the code.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-292-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 05:02:23 2003
Return-Path: <uhcosc1320-return-292-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RA2M5Z1355881
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 05:02:22 -0500 (CDT)
Received: (qmail 980 invoked by uid 108); 27 Jul 2003 10:06:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27774 invoked from network); 27 Jul 2003 09:59:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270954.h6R9sjXQ1346920@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:54:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] getError() function follow up (fwd)
Status: O
X-UID: 288
Content-Length: 340
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>I just looked at the output on the assignment webpage and figured out =
>the answer to my own question.  Sorry for wasting your time!  Thanks =
>again,

No problem.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-293-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 05:05:30 2003
Return-Path: <uhcosc1320-return-293-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RA5R5Z1358308
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 05:05:29 -0500 (CDT)
Received: (qmail 2769 invoked by uid 108); 27 Jul 2003 10:09:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2354 invoked from network); 27 Jul 2003 10:09:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307271004.h6RA4enu1254524@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 05:04:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] I don't understand (fwd)
Status: O
X-UID: 289
Content-Length: 959
X-Keywords: $NotJunk                                                                                           

>I appreciate that the TA's are willing to help out with the labs, 
>but I work an hour away from the school, and I have a full time 
>job.  I know that the TA's work for the school, as well as go to 
>school too.  So the full time students would benefit from this 
>more that a person that can only take night courses.  Breaking 
>away from work, even at 4:30, is very difficult.  I also 
>appreciate  that you are trying to help in every way possible.  
>Thanks

I know it is difficult to utilize the help of the TA if you 
work full time. In the past two weeks, almost every day 
(Monday thru Thursday that is), I have been on campus past 
9PM! I have had students who have stayed behind after the class 
and asked all kinds of questions. I welcome you to do the
same if you would benefit from it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-294-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 05:07:51 2003
Return-Path: <uhcosc1320-return-294-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RA7m5Z1365710
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 05:07:49 -0500 (CDT)
Received: (qmail 4172 invoked by uid 108); 27 Jul 2003 10:12:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27291 invoked from network); 27 Jul 2003 09:58:29 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270953.h6R9ruoG1318824@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:53:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] getError() function (fwd)
Status: O
X-UID: 290
Content-Length: 599
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>What exactly do you want our getError function to say(do)?  What kind of =
>specifics should it give for the error?  Thank you.
>

>From the output file given as part of the assignment, the message reads

Access attempt position 19 on string of size 17

The get error should return

Access attempt position x1 on string of size x2

where x1 and x2 are numbers to be filled in by your getError before it returns the
message.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-295-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 05:16:37 2003
Return-Path: <uhcosc1320-return-295-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RAGZ5Z1374811
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 05:16:35 -0500 (CDT)
Received: (qmail 8957 invoked by uid 108); 27 Jul 2003 10:20:59 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28700 invoked from network); 27 Jul 2003 10:00:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270955.h6R9tuvq1350529@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:55:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Debug (fwd)
Status: O
X-UID: 291
Content-Length: 482
X-Keywords: $NotJunk                                                                                           

>Venkat,
>I have an error message : "the file does not exist, do
>you want to build it?" every time I try to debug even
>if i click "yes" to build it, then I press F11 to step
>into, but this msg still appears.  I don't know what
>problem?
>
>Thanks

Hummm. You may try to click on Build, Rebuild all and see
if that helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-296-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 05:23:47 2003
Return-Path: <uhcosc1320-return-296-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RANj5Z1382986
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 05:23:46 -0500 (CDT)
Received: (qmail 13112 invoked by uid 108); 27 Jul 2003 10:28:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12869 invoked from network); 27 Jul 2003 10:27:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307271023.h6RAN3vU1379671@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 05:23:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] I don't understand (fwd)
Status: O
X-UID: 292
Content-Length: 4155
X-Keywords: $NotJunk                                                                                           

>Again, I appreciate that you are trying to do everything that you 
>can to help.  The position that I'm in at work, doesn't offer a 
>practical application of what I'm going to school for, so the only 
>real thing that I have to go by, is the books.  I know that 
>practice makes perfect.  However, I don't have any ideas about 
>what to write code for.  If you have any suggestions about what to 
>practice, as far as writing code from scratch, that would 
>definitely be helpful.  

I mentioned this in the class. First thing I recommend is to
take the examples I write in class and you rewrite them
all by your self. See how it works. Step through and understand
what it is going. Then ask questions to your self as to
why it is going what you are seeing. This furthers your
understanding of the program behavior. As you start doing this,
you will get motivated to modify code and that will further
your understanding.

>In your words, who should be taking these classes?  Or what level 
>of experience should a person be at before taking them?  

The person should have a very good understanding of C to start with.
If the person has taken 1410, it would help if they were able  to
grasp those concepts fairly well and are comfortable reading and
writing C code. If this course is in the Summer, they should
be pretty shrewd to catch concepts (and from your earlier emails
I think you are since you said you can understand every thing in 
class) and need to have time to play with writing code.

>The reason I ask, is because it has been my understanding that an 18 
>or 19 year old high school graduate should be able to walk in, 
>take classes and graduate with a bachelor's degree, primarily in 4 
>years.  Since this is now a freshman level course, is it designed 
>so that someone with little to no programming experience could do 
>just that, walk in and take this course after 1410?  I think that 
>the proposal to the department is a good idea, for future 
>classes.  Unfortunatly, this doesn't help the students that are 
>taking this class this semester.  

I used to joke about this years ago. I got a book titled
"C++ in 21 days." I put it under my pillow and slept for
21 nights and carried it around. At the end of 21 days,
I should have known all about C++, right.

Unfortunately, it is not like the gadget that we see in 
Matrix. We wear it on, turn on the switch and it tells us
"You have been uploaded with the concepts of C++. Being
to program."!

I would not take a programming course if I will not have time to 
program. Let's say I have an option of taking a theory course
(where you read, understand, and solve problems on paper)
vs. a programming course. In a regular semester, I will mix some
theory courses with programming courses. I would personally
never take more than one programming course at a semester.

If I work full time and go to class four nights a week,
I pretty much do not have much time for any thing from 
6AM Monday to 5PM Friday. This is fine if I am
taking a theory course. I can then may be read up over the 
weekend and may be some during the nights if need be.

Programming takes a significantly more time. It is not humanly
possible to take a programming course of this magnitude
and work full time at the same time, unless you have worked for 
years and you are very comfortable with some concepts and you want to
futher into this area. An 18 or 19 year old working full time
will not be in that category.

>Thank you for letting me voice my concerns.  I do appreciate it, 
>and thank you for your responses.

Raising your concerns helps each of us to see ways in which things can 
be improved. I am taking these to make some changes. How much
change can be made is not in my hands, but I will try. 

Keep us the hard work. If you consider going into programming or
software development for a living, you will remember this day back
and you will be glad you put in your best efforts. Hey, 20 years from now,
write to me and let me know. :)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-297-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 05:24:58 2003
Return-Path: <uhcosc1320-return-297-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RAOu5Z1382808
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 05:24:56 -0500 (CDT)
Received: (qmail 14018 invoked by uid 108); 27 Jul 2003 10:29:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27528 invoked from network); 27 Jul 2003 09:13:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307270908.h6R98lha1305228@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 04:08:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator+ mismatching (fwd)
Status: O
X-UID: 293
Content-Length: 780
X-Keywords: $NotJunk                                                                                           

>Venkat, 
>
>I cannot figure out why it is a type mismatch for
>
>const String String::operator +(const char* s)
>
>for
>
>String greet = hello + " there ";
>
>With an error: 'operator +' must have at least one formal parameter of
>class type
>
>"this" is hello and " there" is a char* ? I think I am missing something
>=(

Looking at the declaration of operator+ you have given, we are violating
one of the rules - lets make a method const if we can. 

The operator+ as you have mentioned above is not a const method. 

In main, hello is defined as a const object.

You can not call a non-const method on a const object!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-298-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 05:35:00 2003
Return-Path: <uhcosc1320-return-298-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RAWi5Z1375342
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 05:34:59 -0500 (CDT)
Received: (qmail 18536 invoked by uid 108); 27 Jul 2003 10:37:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17081 invoked from network); 27 Jul 2003 10:34:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307271030.h6RAUEwV1379703@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 05:30:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Runtime error - Assignment 2 (fwd)
Status: O
X-UID: 294
Content-Length: 1083
X-Keywords: $NotJunk                                                                                           

>Could you please look at my code (I attached the files), for some reason it keeps giving me an error when it is running it, says it has encountered a problem and needs to close.  I tried going through the debugging but when it gets to the first catch, wich calls on getError, I get an error message and get kicked out of the debugging.  I'm not sure what is wrong could you please help.  I don't have much time to work on this tomorrow so I really needed to get it done today.  Thanks.

In your OutofRange class, you have a pointer named Err. However, you have not initialized it
or allocated memory for the message at all. This is the most likely cause of the problem.

You have set methods on OutOfRange class to set the length and position. Why not take these as 
part of the constructor arguments? This will also help you pay a bit more attention on what 
all initialization you need to do when writing the constructor.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-299-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 05:38:00 2003
Return-Path: <uhcosc1320-return-299-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RAbu5Z1387129
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 05:37:56 -0500 (CDT)
Received: (qmail 22263 invoked by uid 108); 27 Jul 2003 10:42:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20288 invoked from network); 27 Jul 2003 10:39:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307271032.h6RAWMXQ1393198@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 05:32:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Operator = and + (fwd)
Status: O
X-UID: 295
Content-Length: 1142
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>Sorry for emailing you so late, but I can't figure out these
>errors. When I build, it gives me these 3 errors:
>
>Compiling...
>assign2.cpp
>error C2440: 'initializing' : cannot convert from 'char [7]' to
>'class String'No constructor could take the source type, or
>constructor overload resolution was ambiguous
>error C2678: binary '+' : no operator defined which takes a
>left-hand operand of type 'const class String' (or there is no
>acceptable conversion)
>error C2106: '=' : left operand must be l-value
>String.cpp
>Error executing cl.exe.
>
>assign2.exe - 3 error(s), 0 warning(s)
>
>Is it because there is something with the way I've written my
>overload for = and +?? Do you have to initialize the string in
>the overload? What does it mean that 'no constructor will take
>the source type'? I'm not really understanding what the error is
>trying to say...I've attached my String.cpp and .h files...please
>take a look. I would be more than grateful for your help...Thanks.

You need a constructor for String that takes a const char* as
argument.

You also need to make your operator+ method a const method.

Venkat

From uhcosc1320-return-300-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 09:56:54 2003
Return-Path: <uhcosc1320-return-300-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6REus5Z1301554
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 09:56:54 -0500 (CDT)
Received: (qmail 8946 invoked by uid 108); 27 Jul 2003 15:01:19 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7304 invoked from network); 27 Jul 2003 14:58:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307271454.h6REsEwo1295888@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 09:54:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Overloading >> for entire buffer (fwd)
Status: O
X-UID: 296
Content-Length: 689
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I noticed in the output example for Assignment 2 that the >> operator =
>only inputs text up to the first space.  I figured out a workaround =
>using cin.getline, but then realized that this would not work for any =
>other input stream object that does not have a public getline function.  =
>Is this something we need to worry about on this assignment, or should =
>we just let it go?
>
>Thanks,

Do not worry too much about this one. 
As far as this assignment is concerned all we are interested is
in cin for input.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-301-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 09:59:02 2003
Return-Path: <uhcosc1320-return-301-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6REx25Z1306860
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 09:59:02 -0500 (CDT)
Received: (qmail 10742 invoked by uid 108); 27 Jul 2003 15:03:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8854 invoked from network); 27 Jul 2003 15:01:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307271456.h6REuegm1300665@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 09:56:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Error- Assignment 2 (fwd)
Status: O
X-UID: 297
Content-Length: 1204
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>Can you please take a look at my code and the following errors.
>
>main.cpp(26) : error C2678: binary '[' : no operator defined which takes a 
>left-hand operand of type 'const class String' (or there is no acceptable 
>conversion)
>
>main.cpp(36) : error C2678: binary '[' : no operator defined which takes a 
>left-hand operand of type 'const class String' (or there is no acceptable 
>conversion)
>main.cpp(68) : error C2106: '=' : left operand must be l-value

This has been discussed in a few emails. Have you written two
operator overloaded [] methods. One which is a const method and the
other which is not. The const method returning a const reference.
The non-const method returning a non-const reference.

>I tried to compile my program without the [] operator to see if the rest is 
>working but I think I have a memory leak when i enter the ">> operator" cuz the 
>program terminates after that. Also when i try to debug it I get an error 
>about Access Vioaltion.
>Can you plaese suggest something. I have attached my zipped files with it.
>Thanks

Every thing you are referring to has been addressed in previous emails.
Please refer to those (sent yesterday and today).

Venkat

From uhcosc1320-return-302-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 11:53:32 2003
Return-Path: <uhcosc1320-return-302-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RGrV5Z1071542
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 11:53:31 -0500 (CDT)
Received: (qmail 23365 invoked by uid 108); 27 Jul 2003 16:57:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23090 invoked from network); 27 Jul 2003 16:57:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307271653.h6RGr03U1070933@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 11:53:00 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Re: Code review and comments
Status: O
X-UID: 298
Content-Length: 1323
X-Keywords: $NotJunk                                                                                           

>Thank you for taking the time to offer assistance.  Here is my complete code, 
>any observations would be appreciated.
>
>...code deleted...

While the following is based on your code, I will mention it in
general terms so that it may be useful for any one in the class.

1. Make sure you follow the commenting style said in
	http://www.cs.uh.edu/~svenkat/C++CodingStandard

2. While it is perfectly ok to have a constructor with no arguments
	and one which takes const char*, you could have simply written
	just one with a default argument. Do not make this change
	right now, as I said if you wrote one with no arguments and
	one with const char*, that is OK.

3. Do you really need to overload operator+ for string and const char*?
	Will the operator+ for String and String take care of this?

4. Revist each method of you class and ask yourself, should this method
	be a const method?

5. Have you followed law of big three.

6. It is better to use strcat to contactenate the characters instead
	of using multiple calls to strcpy.

7. For ever new you use, make sure that what's created on the heap is
	being release some where or the other within your class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-303-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 11:59:08 2003
Return-Path: <uhcosc1320-return-303-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RGx85Z1082127
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 11:59:08 -0500 (CDT)
Received: (qmail 28017 invoked by uid 108); 27 Jul 2003 17:03:34 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27025 invoked from network); 27 Jul 2003 17:02:16 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307271657.h6RGvi2p1074464@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 11:57:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] String constructor (fwd)
Status: O
X-UID: 299
Content-Length: 1410
X-Keywords: $NotJunk                                                                                           

>In your previous emails, you stated that the String constructor should take const char* as the argument.  In my constructor as below:
>
>String::String(char *other){
...deleted...
>
>doesn't take it as const, and it runs without errors.  When I do place a const, I get a error stating:
>
>Linking...
>main.obj : error LNK2001: unresolved external symbol "public: __thiscall String::String(char *)" (??0String@@QAE@PAD@Z)
>Debug/assign2.exe : fatal error LNK1120: 1 unresolved externals
>Error executing link.exe.
>
>I made the change of the const in my .cpp and .h file.  Why am I getting an linking error?  Any suggestions.  Thanks.

First make sure the const char*  for the constructor really appears both
in the declaration in .h and the implemetation in the .cpp.

Second, make sure when you are compiling, both assign2.cpp and String.cpp
are being compiled. If you are using visual studio, make sure both these
.cpp files are part of your project.

Third, do a build, rebuild all to perform a complete build instead of
the incremental build visual studio performs. This can be done by
clicking on Rebuild All menu item under the Build menu.

If none of this works, you may email the code to me in complete and 
I may be able to find the problem.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-304-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 12:07:49 2003
Return-Path: <uhcosc1320-return-304-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RH7n5Z1107037
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 12:07:49 -0500 (CDT)
Received: (qmail 2792 invoked by uid 108); 27 Jul 2003 17:12:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 417 invoked from network); 27 Jul 2003 17:09:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307271705.h6RH56WM1101303@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 12:05:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator+ (fwd)
Status: O
X-UID: 300
Content-Length: 923
X-Keywords: $NotJunk                                                                                           

>When I call on the operator+ method, the two string are concatenated and output the results.  However, it also seems to output garbage before it though.  I debuged it and found its from the garbage when the character aray was created.  I have tried different ways to clean the array, but I seem to get a debug error.  I tried setting newstring.ptr to "" and NULL and "  " but I always seem to get a debug failure or access violation.  Any ideas as to how to overcome this problem?  Below is the implementation of the operator+. Thanks again.
>

Try the following:

char* pMyNewStr = new char[strlen(ptr) + strlen(operand2.ptr) + 1];
strcpy(pMyNewStr, ptr);
strcat(pMyNewStr, operand2.ptr);
String resultString = pMyNewStr;
delete[] pMyNewStr;
return resultString;

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-305-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 15:58:22 2003
Return-Path: <uhcosc1320-return-305-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RKwM5Z1147835
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 15:58:22 -0500 (CDT)
Received: (qmail 28917 invoked by uid 108); 27 Jul 2003 21:02:44 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28018 invoked from network); 27 Jul 2003 21:01:18 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307272056.h6RKuiUd1157260@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 15:56:44 -0500 (CDT)
Cc: jqchen@cs.uh.edu (Jinqiang Chen)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] I don't understand (fwd)
Status: O
X-UID: 301
Content-Length: 2376
X-Keywords: $NotJunk                                                                                           

Thanks Jin.

Regards,

Venkat

>Venkat:
>
>I am going to be in the lab PGH547 where there are some black Dell
>desktop. Since Visual Studio is installed on these computers, it would be
>easier to help students than do in other location.
>Thanks.
>
>Jin
>
>On Sat, 26 Jul 2003, Dr. Venkat Subramaniam wrote:
>
>> >Venkat:
>> >
>> >I can provide help in the lab on Tuesday from 11:00am to noon.
>> >Thanks.
>> >
>> >Jin
>>
>> Jin,
>>
>> Thanks very much for the quick response.
>>
>> That is one more time for you to utilize the help of Jin in
>> addition to his office hours.
>>
>> Jin, please let us know where you will be at this time -
>> in the lab PGH 547, or some other lab or in your office location posted
>> on the web site.
>>
>> Regards,
>>
>> Venkat
>>
>> >
>> >On Sat, 26 Jul 2003, Dr. Venkat Subramaniam wrote:
>> >
>> >> >I think that we've learned more from you in this short period of time, than we
>> >> >would during the semester with the other proffessors that teach this course.
>> >> >It is very hard trying to understand everything though, in such a short period
>> >> >of time.  And implementing what we've learned in the assignments is very
>> >> >difficult at times because one day we learn it and the next we're trying to
>> >> >use it in our program without really understanding it very well sometimes.
>> >> >Having someone around the lab while we're working on our assingments would be
>> >> >great!
>> >>
>> >> This is a very good suggestion. I am forwarding this email to the
>> >> TAs of the course to see if their schedule will allow them to
>> >> be present for some additional time during the next two weeks.
>> >>
>> >> Jin and Meizhuo, if your schedule will allow you to be present
>> >> in the lab to guide the students a bit more, please let me know
>> >> the hours and I will send it to the class.
>> >>
>> >> Venkat Subramaniam
>> >> --
>> >> cosc155g@bayou.uh.edu		Department of Computer Science
>> >> http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475
>> >>
>> >
>> >
>>
>>
>>
>> Venkat Subramaniam
>> --
>> cosc155g@bayou.uh.edu		Department of Computer Science
>> http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475
>>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-306-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 16:08:42 2003
Return-Path: <uhcosc1320-return-306-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RL8g5Z1186876
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 16:08:42 -0500 (CDT)
Received: (qmail 3299 invoked by uid 108); 27 Jul 2003 21:13:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29935 invoked from network); 27 Jul 2003 21:04:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307272059.h6RKxVI41162677@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 15:59:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] operator+ (fwd)
Status: O
X-UID: 302
Content-Length: 624
X-Keywords: $NotJunk                                                                                           

>Thanks a lot for your help.  I started thinking about what you were doing  and I did a little alteration to the code as follows:
>
>...deleted...
>This way I don't have to call the delete or anything. (correct?)  I appreciate it greatly.  Thanks again.

Yes, the way you have written, you do not have to call delete.
Also, note that you are creating an array by using strlen... + 2.
There is not need to add 2. Adding 1 is enough as in the example
code I had sent.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-307-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 16:11:01 2003
Return-Path: <uhcosc1320-return-307-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RLB15Z1186333
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 16:11:01 -0500 (CDT)
Received: (qmail 5177 invoked by uid 108); 27 Jul 2003 21:15:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4956 invoked from network); 27 Jul 2003 21:15:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307272110.h6RLATa11185748@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 16:10:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] input operator (fwd)
Status: O
X-UID: 303
Content-Length: 1175
X-Keywords: $NotJunk                                                                                           

>For the input operator, is there like a maximum size of the array.  I ask 
>because I create a character pointer and I wanted to have this pointer point 
>to an char array created on the heap.  Currently, my input operator is as 
>follows:
>
...deleted...
>	char * input=0;
>	in >> input;

This is trouble waiting to happen.

>...deleted...

>When I debug this, I find that when I input something into character pointer input, I get an error about a zero reference.  I also tried to in>> char input; but that gives me an error stating unexpecter type 'char'. I've also tried creating char input[100] as a test and when I run the code and give an input, I get debug assertion, and the debug seems to show an error in my output operator as follows:
>
...deleted...
>
> I doubt it has anything to do with the output since it works when I use it to output a String object.  Any ideas?  Thanks again.
>

You may want to create an array of size 1024 (which you can assume as
the maximum allowed) and read into that array.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-308-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 16:13:37 2003
Return-Path: <uhcosc1320-return-308-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RLDb5Z1195211
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 16:13:37 -0500 (CDT)
Received: (qmail 7013 invoked by uid 108); 27 Jul 2003 21:17:59 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2773 invoked from network); 27 Jul 2003 21:12:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307272107.h6RL7lgW1185025@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 16:07:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] throw OutOfRange not returning proper address (fwd)
Status: O
X-UID: 304
Content-Length: 700
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
> 
>When my program enters the print function defined in main, it encounters
>an error in the second catch statement (where stringobj[19] was
>accessed). The problem is that it is returning junk and then it simply
>crashes. I placed a few breakpoints and noticed that my operator[]
>returns a address other than what was created in the OutOfRange
>constructor. I have included my OutOfRange class and the operator[]
>function. Could you please tell me what seems to be the problem?
>
>... deleted ...

Looking at the part of the code you had email, I am not 100% sure.
It appears that you are not following law of big three when you 
wrote your class. That is all I can think of.

Venkat

From uhcosc1320-return-309-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 16:21:56 2003
Return-Path: <uhcosc1320-return-309-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6RLLt5Z1216246
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 16:21:55 -0500 (CDT)
Received: (qmail 12724 invoked by uid 108); 27 Jul 2003 21:26:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31012 invoked from network); 27 Jul 2003 21:05:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307272100.h6RL0sfj1168337@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 16:00:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] about >> operator? (fwd)
Status: O
X-UID: 305
Content-Length: 420
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>Looking at your output i assume that u used cin instead of getline to input 
>the string.
>Does it mean that you don't want us to use getline for this?
>Thanks

getline is a method of cin as well, isn't it.
So, if I am using getline, I am using cin.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-310-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 19:22:48 2003
Return-Path: <uhcosc1320-return-310-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6S0Mm5Z1144071
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 19:22:48 -0500 (CDT)
Received: (qmail 29908 invoked by uid 108); 28 Jul 2003 00:27:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28159 invoked from network); 28 Jul 2003 00:24:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307280019.h6S0JlCI1133724@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 19:19:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator[] (fwd)
Status: O
X-UID: 306
Content-Length: 874
X-Keywords: $NotJunk                                                                                           

>For the operator[], I created the exception for array out of bounds.  When I do a test run and create a String object with some array, I try to find the character element outside the array bounds, I get a message about debug assertion failed. I try to debug it and when I reach the line that states "throw..." I get the same error of debug assertion failed.  I am not being able to find out why I am getting the error.  Can you please assist and guide me as where I may be going wrong?  Below is my code for operator[] and my class OutOfRange.   Thank you greatly.
>
...deleted...

The sympotoms you have described are similar to what others have
written about and the response to those are in the previous
emails.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-311-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 19:26:33 2003
Return-Path: <uhcosc1320-return-311-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6S0QW5Z1153649
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 19:26:32 -0500 (CDT)
Received: (qmail 32183 invoked by uid 108); 28 Jul 2003 00:30:55 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30565 invoked from network); 28 Jul 2003 00:28:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307280023.h6S0NesW1100099@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 19:23:39 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator>> (fwd)
Status: O
X-UID: 307
Content-Length: 614
X-Keywords: $NotJunk                                                                                           

>I had a quick question.  Is the operator>> suppose to print to the screen what we input?  My operator>> is like the example in class with the return in and I wasn't sure if you wanted us to print to the screen out input.  I tried without the 'return in' and I got an error saying that it needs a return value.  Thanks.
>
...deleted...

I have given a sample output file. That should help you decide what
you should do in this method you are referring to.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-312-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Jul 27 19:27:15 2003
Return-Path: <uhcosc1320-return-312-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6S0RF5Z1152832
	for <cosc155g@bayou.uh.edu>; Sun, 27 Jul 2003 19:27:15 -0500 (CDT)
Received: (qmail 428 invoked by uid 108); 28 Jul 2003 00:31:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29785 invoked from network); 28 Jul 2003 00:27:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307280022.h6S0MTtN1136614@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 27 Jul 2003 19:22:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] input operator (fwd)
Status: O
X-UID: 308
Content-Length: 848
X-Keywords: $NotJunk                                                                                           

>I made the change to the input operator as follow:
...deleted...
>with the setstring function being:
>
>void String::setstring(char* other) {ptr = other;}
>
>but when I input something into 'input', I still get a debug assertion failed message.  Do you think I may be missing something.  Thanks again.

The setstring method is a dynamite ready to explode. You 
are setting the pointer of your object to a pointer given from
outside the object. Don't you have to make a copy of what's
given to the object instead? Infact in the method that is
calling the setstring, the character array will die at the
end of the method, and now the object will be pointing to 
array that no longer exists!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-313-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 28 12:56:37 2003
Return-Path: <uhcosc1320-return-313-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6SHua5Z1146458
	for <cosc155g@bayou.uh.edu>; Mon, 28 Jul 2003 12:56:36 -0500 (CDT)
Received: (qmail 20279 invoked by uid 108); 28 Jul 2003 18:01:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18762 invoked from network); 28 Jul 2003 18:00:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307281755.h6SHtOZ11137621@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 28 Jul 2003 12:55:24 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Performance in Assignment 2
Status: O
X-UID: 309
Content-Length: 731
X-Keywords: $NotJunk                                                                                           

Folks,

If you take a look at the scores for Assignment 2, you will notice
that most people lost points due to the following:

1. Forgot to write comments.
2. Forgot to make query methods const

These were the most common mistakes that people made, in addition to
other mistakes that were not that common.

Hope this will help you get better scores in future assignments.

If you want to try the code to test your code, you can get it
by visiting the page where grades are posted:
http://www.cs.uh.edu/~svenkat/summer2003

and click on Grades and then on points.

Regards,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-314-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 28 13:04:06 2003
Return-Path: <uhcosc1320-return-314-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6SI465Z1158301
	for <cosc155g@bayou.uh.edu>; Mon, 28 Jul 2003 13:04:06 -0500 (CDT)
Received: (qmail 30287 invoked by uid 108); 28 Jul 2003 18:08:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27668 invoked from network); 28 Jul 2003 18:06:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307281801.h6SI1wVA1219092@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 28 Jul 2003 13:01:58 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Review (fwd)
Status: O
X-UID: 310
Content-Length: 508
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>I was wondering if we could have a review for exam 2.  The review we had for exam 1 really helped!
>
>Thank You,

We will! Let's have the review from 7:30PM (to however long you all want to
hang around and ask questions) on Wednesday.

The exam will be one hour on Thursday from 7PM. We will have a class 
before the exam from 6-7PM.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-315-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 28 13:06:49 2003
Return-Path: <uhcosc1320-return-315-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6SI6m5Z1164631
	for <cosc155g@bayou.uh.edu>; Mon, 28 Jul 2003 13:06:48 -0500 (CDT)
Received: (qmail 1290 invoked by uid 108); 28 Jul 2003 18:11:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29275 invoked from network); 28 Jul 2003 18:07:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307281803.h6SI3D5w1151719@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 28 Jul 2003 13:03:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] How would I implement constructor of Person in HW2 (fwd)
Status: O
X-UID: 311
Content-Length: 499
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Why would we use:
>
>pCar = new Car();
>
>If the Car class that is given to us, is an empty class, therefore it is
>assumed that the DEFAULT destructor will be called, hence memory leak
>will be a problem for this type of assignment.
>Does it have to do with the fact that pCar is a pointer?

Wait, if the class is emply, there is no memory to leak!

The destructor of Person will take care of cleaning up the memory of
Person (that is the memory pointed by pCar).

>
>Thanks,
>

Venkat

From uhcosc1320-return-316-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 28 13:17:03 2003
Return-Path: <uhcosc1320-return-316-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6SIH15Z1196825
	for <cosc155g@bayou.uh.edu>; Mon, 28 Jul 2003 13:17:01 -0500 (CDT)
Received: (qmail 7913 invoked by uid 108); 28 Jul 2003 18:21:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6304 invoked from network); 28 Jul 2003 18:20:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307281815.h6SIFVk61054047@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 28 Jul 2003 13:15:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] question on old exam (fwd)
Status: O
X-UID: 312
Content-Length: 2028
X-Keywords: $NotJunk                                                                                           

>Dear Dr. Subramaniam

Dear fellow human, please feel free address me by my first name,
no need for formalities.

>I have number of questions.

"It is better to know some of the questions than all of the answers." 
- James Thurber (1894-1961).

>question 1:
>On one of the question #7 for 2001 midterm2.
>for the form Index indx3 = 3+indx;  I have the following method:
>
>Index operator+(const int& val, const Index& op2)
>
>which is decleared outside of the Index class. However, I couldn't find any 
>way to 
>implement this function without using a set indexValue function which is 
>specified cannot use it. would you please advise .

This one is a teaser. It is very simple.

You would have implemented a member function to perform indx + 2, isn't it.
It would be

Index Index::operator+(const int& val) const
{
	Index temp; 
	temp.indexValue = indexValue + val;
	return temp;
}

Now in your function simply call this one as follows:
Index operator+(const int& val, const Index& op2)
{
	return op2 + val;
}

How about that! ;)

>question 2:
>The reason why you would catch an exception by reference instead of by value 
>is 
>to avoid overhead of copy constructor and destructor. Is there any more 
>reasons other than this?

Not that I know of.

>question 3:
>What is an immutable object? Is it means that the object's variable can only 
>be initialized once and cannot be assigned later, or simply has no argument 
>when it created. Just like one of the exception example which only out put an 
>message.
>I'm i right. Please advise.
>
>Thanks a lot and best regard.

Within a query method (a const method), you are not allowed to modify 
the members of an object. What if you want to modify a member and
that is not considered in principle to be a significant modification
of the object. This can be done using mutable. I will talk about this
in class further.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-317-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 28 13:21:18 2003
Return-Path: <uhcosc1320-return-317-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6SILI5Z1204910
	for <cosc155g@bayou.uh.edu>; Mon, 28 Jul 2003 13:21:18 -0500 (CDT)
Received: (qmail 13170 invoked by uid 108); 28 Jul 2003 18:25:45 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9850 invoked from network); 28 Jul 2003 18:23:08 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307281818.h6SIIUVH1190675@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 28 Jul 2003 13:18:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] test.cpp error (fwd)
Status: O
X-UID: 313
Content-Length: 740
X-Keywords: $NotJunk                                                                                           

>Hello Venkat
>I was trying to use the test.cpp with my code for assignment code. I get this one error on compilation
> 
>error C2662: 'getError' : cannot convert 'this' pointer from 'const class OutOfRange' to 'class OutOfRange &'
>
>and points to this:-
>
>catch(const OutOfRange ex)
>	{
>		cout << "Error: " << ex.getError() << endl;
>	}
>
>why would that be happening and how do i fix it?
>thanks alot

First rule we wrote in class:

Thou shall make a method a const method if possible.

Put the word const at the far right of the method getError and this
error will disappear.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-318-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 28 13:28:00 2003
Return-Path: <uhcosc1320-return-318-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6SIS05Z1222004
	for <cosc155g@bayou.uh.edu>; Mon, 28 Jul 2003 13:28:00 -0500 (CDT)
Received: (qmail 21733 invoked by uid 108); 28 Jul 2003 18:32:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32618 invoked from network); 28 Jul 2003 18:10:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307281805.h6SI5qSV1162711@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 28 Jul 2003 13:05:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] about C++ reference book (fwd)
Status: O
X-UID: 314
Content-Length: 1024
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> 
>        Could you please tell me which reference book is good for C++? In class, you talked about one: Scott, ?? C++. I did not write it down, so I am not sure if it's right. Could you tell me again? Also, would you recommend some other C++ books for me? I am reading one called SAMS C++. It helps! I would like to read more and do some parctics on codings. What is your suggestion? Thanks!
> 

My favorites are the two books from Scott Myers.
1. Effective C++
2. More Effective C++

The one I strongly recommend is 

3. C++ FAQs by Cline (online copy is available as well).

Finally, for good OO discussions I suggest

4. Thinking in C++ by Bruce Eckel (I think online version is available for
this as well).

And if you really want to get to the bottom of this, you would go for

5. The C++ Programming Language by Bjarne Stroustrup.

Have fun!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-319-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Jul 28 14:27:01 2003
Return-Path: <uhcosc1320-return-319-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6SJR05Z1369647
	for <cosc155g@bayou.uh.edu>; Mon, 28 Jul 2003 14:27:00 -0500 (CDT)
Received: (qmail 4200 invoked by uid 108); 28 Jul 2003 19:31:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1327 invoked from network); 28 Jul 2003 19:29:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307281817.h6SIH3Bj1199997@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 28 Jul 2003 13:17:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] about operator+ (fwd)
Status: O
X-UID: 315
Content-Length: 1241
X-Keywords: $NotJunk                                                                                           

>Hi, Dear Dr Subramaniam
>
>Would you please help me check my code for operator+ in assignment 1, it 
>there  memory leak problem ?
>
>    // concatenate right operand to this object and store in a new created 
>object
>    const String& String::operator+( const String& str2 ) const
>    {
>        size_t newLength = stringLength + str2.stringLength;    // new length
>        char* temp    = new char[ newLength +1 ];   // allocate memory space
>        
>        strcpy ( temp, pString );                               // string 
>copy 
>        strcpy ( temp + stringLength, str2.pString );           // string 
>copy
>        
>        String *newStr = new String(temp);      // create a new String object 
>pointer
>                                    // which stores the concatenated two 
>strings
>        delete[] temp;                          // dealocate memory space
>        return *newStr;                         // return the pointer of new 
>object
>}
>
>Thank you very much.

I emailed an implementation of operator+ yesterday. Please 
take a look at that email.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-320-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:06:09 2003
Return-Path: <uhcosc1320-return-320-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TB685Z1087034
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:06:08 -0500 (CDT)
Received: (qmail 9809 invoked by uid 108); 29 Jul 2003 11:10:39 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6310 invoked from network); 29 Jul 2003 11:05:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291100.h6TB0W7C1071917@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:00:32 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment #2 concern (fwd)
Status: O
X-UID: 316
Content-Length: 1332
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I got the grade I expected in Assignment two, a NOT so good one. I am =
>still confused with various functions and logic behind the methods. I am =
>having a lot of fun in the class and I am doing well in the other =
>grading categories, but waht do you suggest I do to catch up with =
>Assignment #2?=20
>
>I know it is going to be a big chunk of the exam we have on Thursday.
>
>Will it be possible to go over it today in class for example?
>
>Best Regards,

>From the two assignments, you notice that writing comments 
following the style suggested will save significant points.
That is the first thing I would take care of.

Second, make sure you follow the things to watch out in C++.
Simply take your code and go through these as a check list.
For example, did I make my functions const, did I follow law of 
big three, etc.

Pay attention to your code details and think of ways in which
the methods could be used. 

And finally, I know this is hard, but start on the assignment/homework
early so you will have time to fix it. Students who start late will
not have time to fix the problems when you find that it does not work.

That is all I can think of.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-321-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:10:55 2003
Return-Path: <uhcosc1320-return-321-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBAt5Z1100587
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:10:55 -0500 (CDT)
Received: (qmail 13330 invoked by uid 108); 29 Jul 2003 11:15:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12230 invoked from network); 29 Jul 2003 11:13:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291109.h6TB9HWJ1096876@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:09:17 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Error compiling test.cpp (fwd)
Status: O
X-UID: 317
Content-Length: 413
X-Keywords: $NotJunk                                                                                           

>I tried compiling my code with your test code, and these are the 
>errors that I'm getting.  Any ideas?  I had to change the void main
>(), to int main().  I'm using Bloodshed C++.  
>
>...deleted...

Make sure that the test.cpp has #include <iostream>.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-322-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:15:00 2003
Return-Path: <uhcosc1320-return-322-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBF05Z1110624
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:15:00 -0500 (CDT)
Received: (qmail 16145 invoked by uid 108); 29 Jul 2003 11:19:35 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8077 invoked from network); 29 Jul 2003 11:08:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291103.h6TB3L3C1081286@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:03:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] grade link (fwd)
Status: O
X-UID: 318
Content-Length: 1103
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>I tried going to http://www.cs.uh.edu/~svenkat/summer2003/grades.html to check the grades and all I see is "Will be updated eventually."  However, one of my friends accessed the same link at the same time and was able to view the grades. How come I can't get to it?

This is a feature. Your browser caches the page and some times even
if the page changes on the server, it does not get displayed.

Assuming you are using Internet Explorer, hold the shift key down
and press the refresh tool button within IE. Also try doing the
same holding the Ctrl down. This works for both IE and Netscape.
This tells the browser to drop its cache and fetch the copy new.

If this does not work, it generally means that a proxy between you
and the server has cached the page and it takes about 24 hours for
it to update generally. Best in this case is to go to another 
machine some where else (at home, office, library, for example)
and try it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-323-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:15:31 2003
Return-Path: <uhcosc1320-return-323-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBFV5Z1110919
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:15:31 -0500 (CDT)
Received: (qmail 16605 invoked by uid 108); 29 Jul 2003 11:20:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9256 invoked from network); 29 Jul 2003 11:09:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291105.h6TB5FAI1084715@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:05:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] old mid term question (fwd)
Status: O
X-UID: 319
Content-Length: 652
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>In an email right now, the person asked about the reasons to would catch an exception by reference instead of by value. One reason would be the one he asked. but in the mid term it asks for 2 reasons. What would be the other one. Thank you. 

I can't think of two good reasons. I can think of one and I mentioned it
in the last email.

We could say it avoids calls to copy constructor and a call to destructor
on that copy (if we can call it two) and makes it more efficient.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-324-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:19:35 2003
Return-Path: <uhcosc1320-return-324-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBJY5Z1123140
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:19:34 -0500 (CDT)
Received: (qmail 19632 invoked by uid 108); 29 Jul 2003 11:24:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17370 invoked from network); 29 Jul 2003 11:20:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291116.h6TBGHvF1260190@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:16:17 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] const for OutOfRange::getError() ? (fwd)
Status: O
X-UID: 320
Content-Length: 1148
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>Can you look at the following code and tell me why its not giving me an 
>error?
>
>class OutOfRange
>{       public:
>                OutOfRange(int sub, int length);
>                const char* getError() const;
>        private:
>                int size;               //size of the string
>                int subscript;
>                char* msg;
>};
>
>const char* OutOfRange::getError() const
>{       sprintf(msg, "Access attempt position %d on string of size %d", 
>subscript, size);
>        return msg;
>}
>
>shouldn't putting a const on the far right give me an error since i am 
>modifying what msg points to??
>
>Thank you

This email was sent before the class yesterday. As we discussed in
class, the C++ runtime (and the compiler) does not consider
the modification to data outside the object to be a violation of
constness. As a result, the compiler does not catch this as an error.
Please refer to the example on mutable we discussed in class yesterday.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-325-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:23:33 2003
Return-Path: <uhcosc1320-return-325-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBNX5Z1125511
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:23:33 -0500 (CDT)
Received: (qmail 22504 invoked by uid 108); 29 Jul 2003 11:28:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19043 invoked from network); 29 Jul 2003 11:23:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291118.h6TBIbUQ1118396@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:18:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Performance in Assignment 2 (fwd)
Status: O
X-UID: 321
Content-Length: 359
X-Keywords: $NotJunk                                                                                           

>Hi, how can we tell which TA graded our assignments? I am somewhat
>disappointed in my grade. thanks

Please visit the course web site. Click on the TA Info link.
You will find the information there.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-326-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:25:16 2003
Return-Path: <uhcosc1320-return-326-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBPF5Z1131081
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:25:16 -0500 (CDT)
Received: (qmail 24005 invoked by uid 108); 29 Jul 2003 11:29:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18016 invoked from network); 29 Jul 2003 11:21:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291117.h6TBHDW91109795@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:17:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] answers for Assignment2 (fwd)
Status: O
X-UID: 322
Content-Length: 262
X-Keywords: $NotJunk                                                                                           

>Vencart, would you mind sending us someone's 100% assignment2 ?

I will forward your email to Vencart.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-327-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:25:27 2003
Return-Path: <uhcosc1320-return-327-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBPR5Z1098854
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:25:27 -0500 (CDT)
Received: (qmail 24312 invoked by uid 108); 29 Jul 2003 11:30:02 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22421 invoked from network); 29 Jul 2003 11:27:56 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291123.h6TBNE1U1133443@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:23:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] test.cpp error (fwd)
Status: O
X-UID: 323
Content-Length: 1405
X-Keywords: $NotJunk                                                                                           

><html><div style='background-color:'><DIV>
><P>Hi Venkat</P>
><P>I understand that we are supposed to make a method const if we can but putting a const on the far right corner like</P>
><P>const char* getError() const;</P>
><P>means that you can't change the object it is being called on, but I am changing the object, I am changing the private member msg which is either changed to </P>
><P>"Access attempt on an empty string"</P>
><P>or </P>
><P>"Access attempt position %d on string of size %d."</P>
><P>where msg is the char* where it gets sprintf to. And char* is a private member.</P>
><P>So how can I include const at the far right. Although I had that in the beginning but I changed it using the reasoning I just gave you. </P>
><P>Am I on the right about the reasoning</P>
><P>Thanks </P>

You could actually write the OutOfRangle class so that you do 
not have to mofify the object within the getError method.

class OutofRange
{
public:
	OutOfRange(int position, int size)
	{
		msg = new char[100];
		sprintf(msg, "Access attempt position %d on string of size %d",
			position, size);

		... change the message as you like here...
	}
	const char* getError() const
	{
		return msg;
	}

	... other necessary methods not shown here...
};

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-328-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:34:33 2003
Return-Path: <uhcosc1320-return-328-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBYX5Z1160788
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:34:33 -0500 (CDT)
Received: (qmail 30742 invoked by uid 108); 29 Jul 2003 11:39:07 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29747 invoked from network); 29 Jul 2003 11:37:48 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291133.h6TBX6RZ1152852@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:33:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] benefits of inheritance???? (fwd)
Status: O
X-UID: 324
Content-Length: 777
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>I'm kind of lost in the class today so can you explain once again what's the benefits of inheritance???? Oh, by the way, what's hierachy again????
> 
>Thanks for reading.

Inheritance is a mechanism by which you specify that the behavior of
one class has all the behavior of another class and you want to
add to that behavior in the derived class. This is a way by which
you can express the "is-a" relationship between abstractions.

Hierarchy is simply the layering or organization of objects.

Of course we have just started the discussion on Inheritance. 
Ask more questions as we discuss this further.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-329-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:49:55 2003
Return-Path: <uhcosc1320-return-329-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBnt5Z1193314
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:49:55 -0500 (CDT)
Received: (qmail 9145 invoked by uid 108); 29 Jul 2003 11:54:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4238 invoked from network); 29 Jul 2003 11:47:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291142.h6TBgsXs1179258@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:42:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Regarding midterm Questions (fwd)
Status: O
X-UID: 325
Content-Length: 708
X-Keywords: $NotJunk                                                                                           

>Mr Venkat 
>
>       can you tell me if this is the answer for Q4) Midterm2 2000
>       a) ostream& operator<<(ostream& out, const String& obj);
>             and istream& operator>>(istream& in, String& obj);
>       b) String& operator=(const String& ) and  char& operator[](int b) 
>const;
>       c) Counter operator++(); and Counter operator++(int); === member 
>functions
>           Counter operator++(Counter& obj); and Counter operator++(Counter& 
>obj,int); === as Global.
>       I really Appreciate it.
>
>Thank you

Sounds reasonable.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-330-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:57:53 2003
Return-Path: <uhcosc1320-return-330-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBvr5Z1214065
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:57:53 -0500 (CDT)
Received: (qmail 15226 invoked by uid 108); 29 Jul 2003 12:02:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8029 invoked from network); 29 Jul 2003 11:53:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291148.h6TBmIpT1196555@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:48:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] question on old exam (fwd)
Status: O
X-UID: 326
Content-Length: 663
X-Keywords: $NotJunk                                                                                           

>So the method:
>Index Index::operator+(const int& val) const
>{
>   	Index temp; 
>   	temp.indexValue = indexValue + val;
>   	return temp;
>}
>would work for 3+ indx.  

How?

The above is a member of Index. So, the left operand will be 
of type Index isn't it. The above will work for indx + 2 and
not for 3 + indx.

>Would it also work for indx+2?  If so, can you explain why the order of the variables doesn't matter? I remember you talking about this, but can you please explain once more. Thanks.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-331-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 06:58:09 2003
Return-Path: <uhcosc1320-return-331-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TBw95Z1219912
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 06:58:09 -0500 (CDT)
Received: (qmail 15486 invoked by uid 108); 29 Jul 2003 12:02:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9377 invoked from network); 29 Jul 2003 11:54:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291149.h6TBntHr1198320@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:49:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Material to be covered on Midterm 2 (fwd)
Status: O
X-UID: 327
Content-Length: 429
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>Today you mentioned the following areas will be covered on Thursday's
>midterm:
> 
>-UML
>-Function / Operator Overloading
>-Exception Handling
> 
>Will "initialization list" and "assigning" be covered on the midterm
>too?
> 
> 
>Thanks,

Yes, they will be.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-332-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 07:01:44 2003
Return-Path: <uhcosc1320-return-332-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TC1i5Z1226288
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 07:01:44 -0500 (CDT)
Received: (qmail 18190 invoked by uid 108); 29 Jul 2003 12:06:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12540 invoked from network); 29 Jul 2003 11:58:52 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291154.h6TBsAtc1203626@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:54:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Mutable in Const vs Static (fwd)
Status: O
X-UID: 328
Content-Length: 532
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>Can you please clarify what are the advantages/disadvantages of using
>mutables on a const method vs. a static method?
> 
>Thanks,

mutable is placed on an instance member. It can't be placed on a
static member. From within a static method you can access only
static members and so, there is no concern of accessing/using
mutable member within a static method.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-333-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 07:09:01 2003
Return-Path: <uhcosc1320-return-333-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TC915Z1245182
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 07:09:01 -0500 (CDT)
Received: (qmail 23901 invoked by uid 108); 29 Jul 2003 12:13:26 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13813 invoked from network); 29 Jul 2003 12:00:39 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291155.h6TBtvGN1215105@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:55:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Inheritance, private variables (fwd)
Status: O
X-UID: 329
Content-Length: 552
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>When we have a class inherit another class, will it also inherit the
>other classes private members or only the public ones are accessible in
>the implantation of the "combined" class?
> 
>Look forward to your response.
> 
>Thanks,

Yes and yes!

It inherits every thing in the class. From the derived class, you can't
directly access the private members/fields of the base class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-335-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 07:10:33 2003
Return-Path: <uhcosc1320-return-335-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TCAW5Z1252021
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 07:10:33 -0500 (CDT)
Received: (qmail 25259 invoked by uid 108); 29 Jul 2003 12:14:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6603 invoked from network); 29 Jul 2003 11:51:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291146.h6TBkP311172446@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 06:46:25 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Operartor = (fwd)
Status: O
X-UID: 330
Content-Length: 1177
X-Keywords: $NotJunk                                                                                           

>So does this mean that a copy constructor and an operator= have the same implementation?  If we have obj1=obj2;, would we be assigning all the private member variable of ob1 equal to the private member variables of obj2?  Isn't this the same as a copy constructor?  

This is some thing that I emphasized strongly in class. Here are the things
we discussed:

1. Within a copy constructor, you only have to assign to member variables.
In operator=, you will have to cleanup (if you have pointers to 
heap, that is) before you start assigning.

2. Within copy constructor, you do not have to check if the other object
is the same as "this." Within operator= you need to.

>Also, what happens when we have pointers?  Would we assign the pointers to the same memory location?  
>Do we have the pointer pointing to the same location for a copy constructor or an operator=?  Thanks for the clarification.  

If you do that, you have a shallow copy. Some times you want that. Other times,
you would want to make a deep copy.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-336-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 09:18:19 2003
Return-Path: <uhcosc1320-return-336-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TEIJ5Z1562382
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 09:18:19 -0500 (CDT)
Received: (qmail 2475 invoked by uid 108); 29 Jul 2003 14:22:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24409 invoked from network); 29 Jul 2003 12:13:48 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291209.h6TC97Tr1222563@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 07:09:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] exam topics (fwd)
Status: O
X-UID: 331
Content-Length: 463
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>Will static and dynamic binding be on exam 2?  

No.

>
>Will any thing else on Singleton be on exam 2?
>

No.

>Can you explain a virtual function.  Does that have to do with static and dynamic?????
>
>Thank You

We will discuss this extensively in class. We have not gotten to this yet.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-337-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 13:41:53 2003
Return-Path: <uhcosc1320-return-337-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TIfq5Z1174581
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 13:41:53 -0500 (CDT)
Received: (qmail 21229 invoked by uid 108); 29 Jul 2003 18:46:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20136 invoked from network); 29 Jul 2003 18:45:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291840.h6TIesBI1173515@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 13:40:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 3 posted
Status: O
X-UID: 332
Content-Length: 300
X-Keywords: $NotJunk                                                                                           

Greetings,

Assignment 3 has been posted. 

Hope this furthers your understanding of the concepts being discussed in
class this week.

Enjoy.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-339-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 13:52:29 2003
Return-Path: <uhcosc1320-return-339-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TIqT5Z1201603
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 13:52:29 -0500 (CDT)
Received: (qmail 32742 invoked by uid 108); 29 Jul 2003 18:57:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28984 invoked from network); 29 Jul 2003 18:53:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291848.h6TImqDw1192416@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 13:48:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] exam date (fwd)
Status: O
X-UID: 333
Content-Length: 575
X-Keywords: $NotJunk                                                                                           

>Is it possible to push our exam date to monday?Being that we just tuned =
>in our 2nd assingment on sunday. there is barely anytime to study. A =
>group of us was hoping for that two weeks in between the 1st and 2nd =
>exam. The extra days in the weekend will really help.=20
>
>Thanks

Are you sure you want one assignment, two homeworks and two exams due 
next week? Bring this up in class and we can decide then.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-338-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 13:50:33 2003
Return-Path: <uhcosc1320-return-338-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TIoV5Z1193343
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 13:50:31 -0500 (CDT)
Received: (qmail 30568 invoked by uid 108); 29 Jul 2003 18:55:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26576 invoked from network); 29 Jul 2003 18:51:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291846.h6TIkc7H1189420@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 13:46:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Q on Midterms (fwd)
Status: O
X-UID: 334
Content-Length: 1686
X-Keywords: $NotJunk                                                                                           

>Hi venkat
>
>...deleted...
>
>MidTerm - 2 2002
>Q 1)    
>What C++ keyword is used for [5 pts]
>(a)  specifying that a constructor should not be used in type conversions     
>  Explicit
>(b) specifying that a variable may be modified freely within a const method  
>mutable
>(c) specifying that a member is a class member and not an object member     
>private

This should be static.

>(d) referring a class from a namespace only by its name in rest of the code   
>using namespace std;

Just using namespace.

>(e) specifying that a function should be expanded instead of being called  
>inline    
> 
>Q2)
>Mention two reasons why you would catch an exception by reference instead of 
>by value
>1)  To avoid the overhead call to the exception obj copy constructor and 
>destructor.
>2)

? (discussed in previous email).

>Q3)
>(a) ++ can be overloaded only using a member function    false                
> 
>(b) [] can be overloaded using a global function                  false       
>         
>(c) << can only be overloaded using a global function         true            

False. I can overload << on my class say A to do the following:

objA1 << objA2;

Here it acts as binary shift and can be written as a member. 
>     
>(d) the default operator= performs shallow initialization    not sure. My 
>guess is true.                

False. operator= does not perform initialization! (tricky ;))

>(e) If you write only a copy const., default constr. is still available    
>true

False. (another tricky question).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-340-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 13:58:05 2003
Return-Path: <uhcosc1320-return-340-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TIw55Z1217589
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 13:58:05 -0500 (CDT)
Received: (qmail 6266 invoked by uid 108); 29 Jul 2003 19:02:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3474 invoked from network); 29 Jul 2003 19:00:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291855.h6TItJgf1207237@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 13:55:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] midterm2 questions (fwd)
Status: O
X-UID: 335
Content-Length: 754
X-Keywords: $NotJunk                                                                                           

>Venkat, can you help me on some old midterm2 questions.

I will be glad to if you send me the answers like others are doing.

>1)  What C++ keyword is used for:
>          referring a class from a namespace only by its name in 
>          the rest of the code?
>          specifying that a function should be expanded instead 
>          of being called?
>
>2) Is the default operator= perform shallow initialization?
>
>3) "If we write only a copy const., default constructor is still available."  Are you referring to the default copy constructor?  If so, answers is no, correct?
>
>thanks.
>

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-341-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 13:58:59 2003
Return-Path: <uhcosc1320-return-341-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TIww5Z1221704
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 13:58:59 -0500 (CDT)
Received: (qmail 7340 invoked by uid 108); 29 Jul 2003 19:03:31 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2905 invoked from network); 29 Jul 2003 18:59:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291854.h6TIsikt1204000@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 13:54:44 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator ! (fwd)
Status: O
X-UID: 336
Content-Length: 827
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>Can I say "operator!" can only be overloaded by using a global function?

You can say that, but that would be wrong.

>Like, 
>  bool operator!(const String& robj){...};  //unary operator
>I had tried to used the member function when I was doing the assignment2, but it failed.
>So, I think that operator ! can be global function only.
>But, I also know that it depends on the right side of the operator.

No, it depends on the left operand.

>For example, Xobj ! obj.  This case we can use member, but no one write something ugly like that.  Can you tell me the right one?
>
>Thanks

You can write it as a member. Just remember to make it const method.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-342-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 13:59:06 2003
Return-Path: <uhcosc1320-return-342-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TIx65Z1225510
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 13:59:06 -0500 (CDT)
Received: (qmail 7609 invoked by uid 108); 29 Jul 2003 19:03:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30412 invoked from network); 29 Jul 2003 18:54:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291850.h6TIoEm11198118@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 13:50:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] UML question (fwd)
Status: O
X-UID: 337
Content-Length: 466
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>I wonder if UML will be in the next exam. I am sorry that I missed class yesterday. Could you please send out an example how to draw the diagram (question 2, midterm1, summer 2001)
> 
>Thanks.

Yes, it will be in the exam. If you send me an answer, I will be 
glad to comment on and correct it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-343-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 13:59:24 2003
Return-Path: <uhcosc1320-return-343-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TIxN5Z1225836
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 13:59:24 -0500 (CDT)
Received: (qmail 8170 invoked by uid 108); 29 Jul 2003 19:04:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27232 invoked from network); 29 Jul 2003 18:51:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291847.h6TIlEDq1165091@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 13:47:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] old mid term question (fwd)
Status: O
X-UID: 338
Content-Length: 1031
X-Keywords: $NotJunk                                                                                           

>I think that:
>Reason 1: When we rethrow some changes from a caught object to another caught object are not propagated if the object is caught as a value.
>For example:
>...
>catch(X obj)   //catch by value
>{ obj.display();  //display current obj. (example: 100)
>  obj.reset();    //try to reset obj to 0.
>  throw;          //rethrow, but will not propagate.
>}
>catch(X& secObj) //catch it again by ref.
>{
>  secObj.display();  //display the the old obj. (100)
>  secObj.reset();    //try one more time.
>  throw;             //rethrow, it should work this time.
>}
>catch(X thirdObj) 
>{
>  thirdObj.display();  //display (0).
>}

I don't think so. Try out a full working example to see if this is true.

>
>Reason 2: Catching by reference, it eliminates the overhead of copying exception
>object. (This is what our text book says on Ch23)
>
>Does my answers okay?


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-344-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 14:03:25 2003
Return-Path: <uhcosc1320-return-344-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TJ3P5Z1227370
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 14:03:25 -0500 (CDT)
Received: (qmail 12368 invoked by uid 108); 29 Jul 2003 19:07:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1048 invoked from network); 29 Jul 2003 18:57:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291853.h6TIr3TM1208035@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 13:53:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question#4A, on the Old MidTerm2, Sum01 (fwd)
Status: O
X-UID: 339
Content-Length: 1291
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>
>  I'm not sure my answer on #4A, M2, SUM01. Can you take a look?
>
>Thanks
>
>
>#include <iostream>
>using namespace std;
> 
>class Counter
>{
>public:
>    Counter(int val) 
>    { 
>        cout << "Constructor(" << val << ")" << endl;
>        value = val; 
>    }
>    Counter operator+(const Counter& ctr) const 
>    { 
>        cout << "In Operator+" << endl;
>        return value+ctr.value; 
>    }
>    const int& getVal() const { return value; }
>private:
>    int value;
>};
> 
>//4a, What is the default behavior on the call to + in the statement below?   
> 
>void main()
>{
>    Counter ctr1(2);
>    Counter ctr2 = ctr1 + 4;
>    cout << "CTR1 = " << ctr1.getVal() << endl;
>    cout << "CTR2 = " << ctr2.getVal() << endl;
>    cin.get();
>} 
> 
>/* Output
>Constructor(2)
>Constructor(4)
>In Operator+
>CTR1 = 2
>CTR2 = 6
>*/
>
>//I think that "Counter ctr2 = ctr1 + 4;"
>//When the operator+ is called and sees the value 4,
>//it converts the value 4 to a Counter object since
>//there is a construct that takes an integer (int).
>
>//Do I right?
>

Yep, 4 is being promoted to an object of Counter.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-345-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 14:08:00 2003
Return-Path: <uhcosc1320-return-345-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TJ7w5Z1242810
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 14:07:59 -0500 (CDT)
Received: (qmail 17775 invoked by uid 108); 29 Jul 2003 19:12:35 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10931 invoked from network); 29 Jul 2003 19:06:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291901.h6TJ1spi1190623@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 14:01:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] old exam question (fwd)
Status: O
X-UID: 340
Content-Length: 1532
X-Keywords: $NotJunk                                                                                           

>Can you check if the implementation of the methods is correct?
>
>class Person
>{
>      Car* m_pCar;
>      double m_salary;
>      const int m_yearOfBirth;
>public:
>      Person(int yearOfBirth, Car* pCar, double salary): m_yearOfBirth=yearOfBirth

Should be 
Person(int yearOfBirth, Car* pCar, double salary): m_yearOfBirth(yearOfBirth)

>      {
>         m_pCar=0; 
>         m_pCar= new Car;
	
	No need for the first statement if you have the second.

>         m_pCar= &pCar;
	
	No need for the first two statements if you have the third statement.

	The correct code is

	m_pCar = pCar;

>         m_salary= salary;
>      }
>
>      Person(const Person& other)): m_yearOfBirth=other.yearOfBirth

Similar correction here.

>      {
>         m_pCar=0; 
>         m_pCar= new Car;
>         m_pCar= &other.m_pCar;

No way. Fix this and send me an email again.

>         m_salary= &other.m_salary;
>      }
>
>      const Person& operator=(const Person& other): m_yearOfBirth=other.yearOfBirth

Haha. Try implemeting this code and you will understand the problem.
Seriously, try to write thiis code and compile it.

>     {
>        m_pCar=0; 
>         m_pCar= new Car;
>         m_pCar= &other.m_pCar;
>         m_salary= &other.m_salary;
>     }
>
>      ~Person()
>
>      {
>         delete m_pCar;
>      }

The destructor is correct.

>};
>   
>
>Thank you.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-346-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 14:10:48 2003
Return-Path: <uhcosc1320-return-346-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TJAm5Z1249234
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 14:10:48 -0500 (CDT)
Received: (qmail 20949 invoked by uid 108); 29 Jul 2003 19:15:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15087 invoked from network); 29 Jul 2003 19:10:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291905.h6TJ5jCf1207203@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 14:05:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] old exam ?s (fwd)
Status: O
X-UID: 341
Content-Length: 1303
X-Keywords: $NotJunk                                                                                           

>Venkat, can you please see if my answers below are correct?
>
>Given the following class [5]:
>
>class Counter
>
>{
>
>      public:
>
>                  Counter(int val) {value = val; }
>
>                  Counter operator+(const Counter& ctr) const { return value + ctr.value; }
>
>      private:
>
>                  int value;           
>
>};
>
>(a) What is the default behavior on the call to + in the statement below:
>
>void fn()
>{ 
>      Counter ctr1(2);
>      Counter ctr2 = ctr1 + 4; 
>}
>
>
>
>Answer: When the second line is made, 4 is going to be promoted to a type Counter.  Then 2+4 will be done and a return value 6 will be sent to ctr2.
>

The promotion part is correct.  The return value is not 6, but it is
an object of Counter with a value of 6 in it.

> (b) What is the minimal change you would make in the class to avoid compilation of statements like 
>
>Counter ctr2 = ctr1 + 4;
>
> 
>Answer: Place explicit on the constructor such that it becomes: explicit Counter(int val) {value = val; }
>

Good for you.

>Midterm 2 will not involve singleton, correct?
>
>Thanks

We can have it if you insist. Otherwise no. :)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-347-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 14:15:27 2003
Return-Path: <uhcosc1320-return-347-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TJFR5Z1220284
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 14:15:27 -0500 (CDT)
Received: (qmail 26286 invoked by uid 108); 29 Jul 2003 19:20:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12760 invoked from network); 29 Jul 2003 19:08:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291903.h6TJ3UYJ1228247@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 14:03:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] midterm2 question (fwd)
Status: O
X-UID: 342
Content-Length: 2215
X-Keywords: $NotJunk                                                                                           

>For problem 9 of Summer 2002, can you check if the following is correct, please?  Thanks.
>
>9.      Given a class  [10pts](No friends. Do not provide functions to simply break encapsulation)
>
>class TimeOfDay { 
>// Represents time on a 24 hours format 00:00:00 to 23:59:59
>        unsigned int seconds, minutes, hours;
>        
>        void SetTime(unsigned int h, unsigned int m, unsigned int s)
>               { hours = h; minutes = m; seconds = s; 
>               // Assume errors checked here
>               }
>        void AddSeconds(unsigned int sec); 
>public :
> 
>}; // End of Class interface
>// Beginning of class implementation
>void TimeOfDay::AddSeconds(unsigned sec)
>               { 
>                 unsigned int totsec = 
>                   (hours*3600 + minutes * 60 + seconds + sec) % 86400; 
>                 seconds = totsec % 60;
>                 minutes = ((totsec - seconds) % 3600) / 60;
>                 hours = (totsec - minutes * 60 - seconds) / 3600;   }
> 
>/***********************************************************/
>TimeOfDay::TimeOfDay(int h, int m, int s){ SetTime(h,m,s)}
>
>TimeOfDay::TimeOfDay(const TimeOfDay& other){
>           hours=other.hours;
>           minutes=other.minutes;
>           seconds=other.seconds;}
>TimeOfDay::~TimeOfDay(){}
>String(const String& other);
>
>TimeOfDay operator+(const &TimeOfDay obj, const unsigned &sec){
>         TimeOfDay newTime= obj;
>         newTime= newTime.AddSeconds(sec);

AddSeconds is private. You can not call it from this global method.

>         return newTime;} 
>/**************************************************************/ 
> 
> 
>Write code in the space provided above to make the following work:
>void main()
>{
>        TimeOfDay noon(12, 0, 0);      // Noon
> 
>        TimeOfDay thirtypastnoon = noon + 1800;  
>                                      // 1800 seconds after noon
> 
>        TimeOfDay fifteenpastnoon = 900 + noon; 
>                                      // 900 seconds after noon
>}
>
>
>
>thanks for your time.
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-348-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 17:22:44 2003
Return-Path: <uhcosc1320-return-348-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TMMi5Z1189258
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 17:22:44 -0500 (CDT)
Received: (qmail 18567 invoked by uid 108); 29 Jul 2003 22:27:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18083 invoked from network); 29 Jul 2003 22:26:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307292222.h6TMM87l1182330@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 17:22:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] old mid term question (fwd)
Status: O
X-UID: 343
Content-Length: 2907
X-Keywords: $NotJunk                                                                                           

>Here is the full working example, it seems work as what I thought.

:)

Alright my friend (sincerely, I do not mean this in the sense of how much I 
"like" friend in C++), let's take a look at your code.

>#include <iostream> 
>using namespace std;
>
>class X
>{
>private:
>    int i;
>public:
>    X(int Val) { i = Val; }
>    void display() const { cout << i << endl; }
>    void reset() { i = 0; }
>};
>
>void main()
>{
>    try
>    {
>        try
>        {
>                X test(100);    //create an object
>                throw test;     //throw it
>        }
>        catch(X test1)     //catch by value
>        {
>                test1.display();  // display 100
>                test1.reset();    // try to set it to 0
>                test1.display();  // display 0
>                throw;      // rethrow without conversion.
>        }
>    }
>    catch(X test1b)
>    {
>        test1b.display();        //display 100 again
>    }
>    cout << "****************" << endl;
>    try
>    {
>        try
>        {
>            X test2(200);       //create another object
>            throw test2;        //throw it
>        }
>        catch(X& test2)   //catch by reference
>        {
>            test2.display();  // display 200
>            test2.reset();    // set to 0
>            test2.display();  // display 0
>            throw test2;      // rethrow
>        }
>    }
>    catch(X test2b)
>    {
>        test2b.display();     //it will show 0 in this time.
>    }
>        
>    cin.get();
>}
>/** output **
>100
>0
>100
>***************
>200
>0
>0
>**/
>

You have a nested catch and a outer catch. You are trying to figure
out if catching by reference or by value in the inner class makes
a difference in terms of what happens when you throw.
Shoudn't the outer catch be by reference ;) hum hum.

OK, do me a favor. Here is a modified code. Give this a try and
let me know what you think.

Venkat

// Modified code
#include <iostream>
using namespace std;

class X
{
private:
    int i;
    public:
	X(int Val) 
	{ 
		i = Val; 
		display();
	}
	void display() const 
	{ 
	printf("%p %d\n", this, i);
	//cout << i << endl; 
	}
	void reset() { i = 0; }
};

void main()
{
	try
	{
		try
		{
			throw X(100);
		}
		catch(X test1)     //catch by value
		{
			test1.display();  // display 100
			test1.reset();    // try to set it to 0
			test1.display();  // display 0
			throw;      // rethrow without conversion.
		}
	}
	catch(X& test1b)
	{
		test1b.display();        //display 100 again
	}
	cout << "****************" << endl;
	try
	{
		try
		{
			throw X(100);
		}
		catch(X& test2)   //catch by reference
		{
			test2.display();  // display 200
			test2.reset();    // set to 0
			test2.display();  // display 0
			throw;      // rethrow
		}
	}
	catch(X& test2b)
	{
		test2b.display();     //it will show 0 in this time. 
				     // Venkat's comment: Does it?
	}

	cin.get();
}

From uhcosc1320-return-349-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 17:29:41 2003
Return-Path: <uhcosc1320-return-349-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TMTe5Z1208740
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 17:29:40 -0500 (CDT)
Received: (qmail 24667 invoked by uid 108); 29 Jul 2003 22:34:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21539 invoked from network); 29 Jul 2003 22:30:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307292225.h6TMPqRp1204464@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 17:25:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] midterm ?s (fwd)
Status: O
X-UID: 344
Content-Length: 1678
X-Keywords: $NotJunk                                                                                           

>I was wondering if you tell me if the following is correct.  I am aware that some of the questions will not be covered in midterm2.  Thanks.
>
>(a) Conversion from Derived type to Base type requires explicit casting           ________?_______
>

What do you say?

>(b) Operator overloading makes the program run faster                                        _______TRUE________
>

Nope.

>(c) The operator << must be overloaded only as global function                        ______TRUE_________
>

We discussed this in the email this afternoon. I will let you 
read it for the answer to this one.

>(d) You can only create one object of an Abstract Base Class                            ________TRUE_______
>

No (none).

>(e) private inheritance in C++ provides the extensibility                                       _____TRUE________

No, it does not.

>(f) Catching by reference eliminates exception object copy overhead                _______TRUE________
>

You are on the mark with this one.

>***** shouldn't it also be destructor overhead????*****

Sure.

>
>(g) protected inheritance allows derived class to access private data of base _______?________
>

:)

>(h) Using inheritance reduces the time to test a software product                      ________TRUE_______

No it does not.

>
>(i)  Exception handling reduces the need for strong type checking                    ______?_________
>

:)

>(j) A C++ Abstract Base Class has only pure virtual functions                           ________?_______
>

:)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-350-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 17:33:12 2003
Return-Path: <uhcosc1320-return-350-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TMXB5Z1215997
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 17:33:12 -0500 (CDT)
Received: (qmail 27786 invoked by uid 108); 29 Jul 2003 22:37:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24374 invoked from network); 29 Jul 2003 22:33:48 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307292229.h6TMT47g1206387@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 17:29:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] another midterm2 ? (fwd)
Status: O
X-UID: 345
Content-Length: 806
X-Keywords: $NotJunk                                                                                           

>Sorry for the many questions but I have another question regarding question 6 of summer 2000. When you reach the code :
>cout << comp.calc(-2) << endl;
> the second time, the output is 
>Timer Started 
>Invalid number: -2
>
>Why doesn't the output produce the message "Timer Stopped" before the statement "Invalid number: -2"  
>Thanks

Look at the calc method:

	double calc(double number)
	{
		Timer* pTimer = new Timer();
		if (number < 0) throw number;

		double result = number * number;
		delete pTimer;

		return result;
	}

If exception is thrown, the object created on the heap is never 
deleted. That's why the destructor is not called.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-351-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 23:27:03 2003
Return-Path: <uhcosc1320-return-351-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U4R35Z1568174
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 23:27:03 -0500 (CDT)
Received: (qmail 13084 invoked by uid 108); 30 Jul 2003 04:31:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11311 invoked from network); 30 Jul 2003 04:28:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300423.h6U4NqN91556713@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 23:23:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Midterm 2 and Midterm 3 dates
Status: O
X-UID: 346
Content-Length: 364
X-Keywords: $NotJunk                                                                                           

Folks

Midterm 2 will be held on Thursday July 31st.

Midterm 3 will be on Friday August 8th 5 - 7PM.

If you have any questions regarding these, please talk to me
tomorrow before or after class.

Regards,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-352-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 23:52:22 2003
Return-Path: <uhcosc1320-return-352-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U4qL5Z1096702
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 23:52:21 -0500 (CDT)
Received: (qmail 27584 invoked by uid 108); 30 Jul 2003 04:56:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25246 invoked from network); 30 Jul 2003 04:52:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300448.h6U4m16I1088433@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 23:48:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question on Abstract base classes (fwd)
Status: O
X-UID: 347
Content-Length: 514
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>     Do Abstract Base Classes only have pure virtual functions? I think not. Is this right?

No they do not have to. For instance, Animal is abstract, but it 
has eat method which is not even virtual.

If a Abstract Base Class (ABC) has only pure virtual methods, then
it is considered as an interface (since it has no implementation at all).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-353-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:02:42 2003
Return-Path: <uhcosc1320-return-353-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U52f5Z1570336
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:02:41 -0500 (CDT)
Received: (qmail 1024 invoked by uid 108); 30 Jul 2003 05:07:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26988 invoked from network); 30 Jul 2003 04:55:49 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300451.h6U4p3w51091511@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 23:51:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Mid2_Question_1999 (fwd)
Status: O
X-UID: 348
Content-Length: 742
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>PLease check my answers for the following question if I did it right?
>1. Which of the following is proper overloading (Write Yes or No) [5]:
>(a)     void f1(int a);          void f1(double a);                 =
>__Y__
>(b)     void f2(int a);          void f2(int a, int b);             =
>__Y__
>(c)     void f3(int a);          int f3(int a, int b);             __Y__
>(d)     void f4(int a);          int f4(int a);                      =
>__N__
>(e)     void f5(int a);          void f5(int a=0, double b=2.1);     =
>    __Y__
>Thanks a million!

Oh, the last one is not.

If I call f5(4), it will not know if I am calling f5(int a) or
if I am calling f5(a, b) with values 4 for a and 2.1 for b, respectively.

Venkat

From uhcosc1320-return-354-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:04:29 2003
Return-Path: <uhcosc1320-return-354-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U54S5Z1131463
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:04:29 -0500 (CDT)
Received: (qmail 2173 invoked by uid 108); 30 Jul 2003 05:09:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28763 invoked from network); 30 Jul 2003 04:58:49 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300454.h6U4s3jx1103311@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 23:54:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] mid2?_2002 (fwd)
Status: O
X-UID: 349
Content-Length: 800
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>I hope it won't be a problem if you would also check my answer for the =
>below question.

Not at all. In fact, I am so delighted that you are working hard at the exams. 

>2.       Which of the following overloading is unambiguous (write Yes =
>for unambiguous, no otherwise) [5]:
>
>(a) int f1(int a, int b);   double f1(double a, double b);            =
>__Yes_
>
>(b) int f2(int a, int b); double f2(int a, int b)                        =
>   __Yes_

No for this one.

>
>(c) int f3(int a, int b); int f3(int a, int b =1, int c =3);        =
>      __No_
>
>(d) int f4(int a, double b); int f4(double a, int b);                    =
> __Yes_
>
>(e) int f5(int a, int b); int f5(int b, int a);                          =
>      ___Yes_

No for this one.

>
>Thanks again,

Venkat

From uhcosc1320-return-355-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:09:02 2003
Return-Path: <uhcosc1320-return-355-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5925Z1133078
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:09:02 -0500 (CDT)
Received: (qmail 4813 invoked by uid 108); 30 Jul 2003 05:13:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2768 invoked from network); 30 Jul 2003 05:09:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300505.h6U553Ci1129982@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:05:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] #include <....> (fwd)
Status: O
X-UID: 350
Content-Length: 1112
X-Keywords: $NotJunk                                                                                           

>I have noticed that when you send out an email and when you have something #include and something within the triangle bracket, when I receive the email, that triangle bracket and its contents within are deleted.  I had that problem with email regarding assign2 but I thought maybe you wanted us to figure out what was going to be #included.  Do you think there may be a way to solve this problem?  Thanks.
>

I think this is happening because you are using a browser to read
your emails. The browser thinks what is within a <> is a HTML tag
and since stuff like iostream is not a valid html tag, it ignores it.

I am not sure what the solution for this is when you receive email
in text form and display it on the browser. May be there is some
settings you can turn on. I do not read email using a browser 
(I hate the browsers being front end for a number of things including
reading email). Any suggestions from any one who has been there 
done that?

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-356-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:12:28 2003
Return-Path: <uhcosc1320-return-356-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5CR5Z1150280
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:12:27 -0500 (CDT)
Received: (qmail 6903 invoked by uid 108); 30 Jul 2003 05:16:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 830 invoked from network); 30 Jul 2003 05:06:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300502.h6U529Dd1098246@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:02:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] midterm2 question (fwd)
Status: O
X-UID: 351
Content-Length: 2952
X-Keywords: $NotJunk                                                                                           

>I didn't see that AddSeconds was defined private.  There isn't anything defined as private for this example.  If AddSeconds is private, how do you suggest we get around this problem?  Thanks.
>

Any one who wants to take a stab at this one?

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 07/29/03 12:03 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] midterm2 question (fwd)
>
>> 
>> >For problem 9 of Summer 2002, can you check if the following is correct,
>please?  Thanks.
>>
>>9.      Given a class  [10pts](No friends. Do not provide functions to
>simply break encapsulation)
>>
>>class TimeOfDay { 
>>// Represents time on a 24 hours format 00:00:00 to 23:59:59
>>        unsigned int seconds, minutes, hours;
>>        
>>        void SetTime(unsigned int h, unsigned int m, unsigned int s)
>>               { hours = h; minutes = m; seconds = s; 
>>               // Assume errors checked here
>>               }
>>        void AddSeconds(unsigned int sec); 
>>public :
>> 
>>}; // End of Class interface
>>// Beginning of class implementation
>>void TimeOfDay::AddSeconds(unsigned sec)
>>               { 
>>                 unsigned int totsec = 
>>                   (hours*3600 + minutes * 60 + seconds + sec) % 86400; 
>>                 seconds = totsec % 60;
>>                 minutes = ((totsec - seconds) % 3600) / 60;
>>                 hours = (totsec - minutes * 60 - seconds) / 3600;   }
>> 
>>/***********************************************************/
>>TimeOfDay::TimeOfDay(int h, int m, int s){ SetTime(h,m,s)}
>>
>>TimeOfDay::TimeOfDay(const TimeOfDay& other){
>>           hours=other.hours;
>>           minutes=other.minutes;
>>           seconds=other.seconds;}
>>TimeOfDay::~TimeOfDay(){}
>>String(const String& other);
>>
>>TimeOfDay operator+(const &TimeOfDay obj, const unsigned &sec){
>>         TimeOfDay newTime= obj;
>>         newTime= newTime.AddSeconds(sec);
>
>AddSeconds is private. You can not call it from this global method.
>
>>         return newTime;} 
>>/**************************************************************/ 
>> 
>> 
>>Write code in the space provided above to make the following work:
>>void main()
>>{
>>        TimeOfDay noon(12, 0, 0);      // Noon
>> 
>>        TimeOfDay thirtypastnoon = noon + 1800;  
>>                                      // 1800 seconds after noon
>> 
>>        TimeOfDay fifteenpastnoon = 900 + noon; 
>>                                      // 900 seconds after noon
>>}
>>
>>
>>
>>thanks for your time.
>>
>
>
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-357-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:13:49 2003
Return-Path: <uhcosc1320-return-357-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5Dm5Z1153102
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:13:49 -0500 (CDT)
Received: (qmail 7830 invoked by uid 108); 30 Jul 2003 05:18:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32634 invoked from network); 30 Jul 2003 05:05:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300501.h6U515Me1126312@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:01:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] old exam question (fwd)
Status: O
X-UID: 352
Content-Length: 3670
X-Keywords: $NotJunk                                                                                           

>hehehe.  Can I try again?  I made an addition of class Car so the compiler won't give me errors.  Can you check again if the below is correct? Thanks.
>
>class Car{};
>
>class Person
>{
>/**********SHOULDN'T THESE BE PRIVATE???*********************/

They are. If you do not write any thing, a class makes it
members private by default.

>	Car* m_pCar;
>	double m_salary;
>	const int m_yearOfBirth;
>public:
>	Person(int yearOfBirth, Car* pCar, double salary):
>	  m_yearOfBirth(yearOfBirth){
>		  m_pCar=pCar;
>		  m_salary=salary;
>	  }
>
>	  Person(const Person& other): m_yearOfBirth(other.m_yearOfBirth){
>		  m_pCar=other.m_pCar;

This will make the two persons share the same car (not considering
the issue you have mentioned below). If that is not what you want, 
you need to make a deep copy of the Car here.

>		  m_salary=other.m_salary;
>	  }
>	  
>	  const Person& operator=(const Person& other){

So what happend to the year of Birth? 

Bonus point for the first person to solve this issue correctly.

>	  m_pCar= other.m_pCar;
>          m_salary= other.m_salary;
>	  }
>
>	  ~Person(){
>		  delete m_pCar;
>	  }
>
>};
>
>when I had "m_pCar=&other.m_pCar;" in my operator=, I got an error stating "cannot convert from 'class Car *const * ' to 'class Car *'"  What does this error mean?  Thanks again.

This is sticky isn't it. You can cast it to make the assignment work
(I know, after saying all the bad things I can say about casting,
sorry that I am suggesting that). Second option is to see if 
a deep copy of the car really makes sense in this case. If it does
the write

	m_pCar = new Car(*other.m_pCar);

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 07/29/03 12:01 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] old exam question (fwd)
>
>> 
>> >Can you check if the implementation of the methods is correct?
>>
>>class Person
>>{
>>      Car* m_pCar;
>>      double m_salary;
>>      const int m_yearOfBirth;
>>public:
>>      Person(int yearOfBirth, Car* pCar, double salary):
>m_yearOfBirth=yearOfBirth
>
>Should be 
>Person(int yearOfBirth, Car* pCar, double salary):
>m_yearOfBirth(yearOfBirth)
>
>>      {
>>         m_pCar=0; 
>>         m_pCar= new Car;
>   	
>   	No need for the first statement if you have the second.
>
>>         m_pCar= &pCar;
>   	
>   	No need for the first two statements if you have the third statement.
>
>   	The correct code is
>
>   	m_pCar = pCar;
>
>>         m_salary= salary;
>>      }
>>
>>      Person(const Person& other)): m_yearOfBirth=other.yearOfBirth
>
>Similar correction here.
>
>>      {
>>         m_pCar=0; 
>>         m_pCar= new Car;
>>         m_pCar= &other.m_pCar;
>
>No way. Fix this and send me an email again.
>
>>         m_salary= &other.m_salary;
>>      }
>>
>>      const Person& operator=(const Person& other):
>m_yearOfBirth=other.yearOfBirth
>
>Haha. Try implemeting this code and you will understand the problem.
>Seriously, try to write thiis code and compile it.
>
>>     {
>>        m_pCar=0; 
>>         m_pCar= new Car;
>>         m_pCar= &other.m_pCar;
>>         m_salary= &other.m_salary;
>>     }
>>
>>      ~Person()
>>
>>      {
>>         delete m_pCar;
>>      }
>
>The destructor is correct.
>
>>};
>>   
>>
>>Thank you.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-358-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:15:10 2003
Return-Path: <uhcosc1320-return-358-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5F95Z1140395
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:15:10 -0500 (CDT)
Received: (qmail 8657 invoked by uid 108); 30 Jul 2003 05:19:44 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4448 invoked from network); 30 Jul 2003 05:12:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300508.h6U58Dju1140189@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:08:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Midterm topic? (fwd)
Status: O
X-UID: 353
Content-Length: 609
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>Will "FRIENDS" be covered on the exam?
> 
>I know you told us NOT to have friends (in C++), but is that the only
>thing you want to know about this topic?
> 
>Or do you expect to be familiar with the syntax and examples of
>"friendships" for lack of a better term.
> 
>Look forward to your response.
> 
> 
>Thanks,

So, do you really want to learn the syntax and practice what I
am fighting to get rid of. Is that what you are saying? :)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-359-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:23:17 2003
Return-Path: <uhcosc1320-return-359-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5NG5Z1556823
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:23:17 -0500 (CDT)
Received: (qmail 13699 invoked by uid 108); 30 Jul 2003 05:27:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10892 invoked from network); 30 Jul 2003 05:23:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300518.h6U5Icu61345256@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:18:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] MID2?_2002 (fwd)
Status: O
X-UID: 354
Content-Length: 437
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>Here's another question.=20
>If you ask for an example of an operator (other than=) that must be =
>overloaded using a member function and show the code. Should I write =
>this?
>
>           Counter Counter::operator++(int)
>...deleted...
>
>Thanks a bunch!

Well, you see, operator++ does not have to be overloaded as member.
It may be overloaded as global as well. So, no this will not be
the correct answer.

Venkat

From uhcosc1320-return-360-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:25:40 2003
Return-Path: <uhcosc1320-return-360-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5Pe5Z1181839
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:25:40 -0500 (CDT)
Received: (qmail 15326 invoked by uid 108); 30 Jul 2003 05:30:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7789 invoked from network); 30 Jul 2003 05:18:24 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300513.h6U5DcSr1153647@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:13:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question regarding mutable/immutable (fwd)
Status: O
X-UID: 355
Content-Length: 1540
X-Keywords: $NotJunk                                                                                           

>Hello Venkat;
> 
>I was wondering if you could explain what an immutable object is. I have
>written in my notes that a mutable variable is a variable that can be
>changed in a in a query method, ie a const on the far right. However I
>did not see anything about an immutable object. Can you help?
>
>
>Thank you,

Good question. Immutable object has nothing to do with the 
concept of mutable variable in C++.

An immutable object is an object that can not be modified once it
is created. 

Example:

class Brush
{
public:
	Brush(Color clr);

	Color getColor() const;
private:
...
};

Looking at this class, you realize once you create the Brush, you 
can ask for its color. But ther is no way to change the color of
the Brush or any thing else in it.

An immutable object generally does not provide any methods that
will modify the object. 

What's the benefit of this. Since immutable objects do not change
state, they stay in the state in which they are created until they die.
This leads to the possiblity that you may share the internals between
objects of this type.

For example,

Brush b1(Color.red);
Brush b2(Color.blue);
Brush b3(Color.red);

The Brush class may be written so that b1 and b3 do not really have
their individual copy of the color, but share the color red. This 
saves memory. The fact that neither of them can change, sharing
becomes easier to implement.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-361-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:27:18 2003
Return-Path: <uhcosc1320-return-361-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5RI5Z1181279
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:27:18 -0500 (CDT)
Received: (qmail 16502 invoked by uid 108); 30 Jul 2003 05:31:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9478 invoked from network); 30 Jul 2003 05:20:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300516.h6U5G8mC1155911@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:16:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] midterm ?s (fwd)
Status: O
X-UID: 356
Content-Length: 436
X-Keywords: $NotJunk                                                                                           

>> >I was wondering if you tell me if the following is correct.  I am aware
>that some of the questions will not be covered in midterm2.  Thanks.
>>
>>(a) Conversion from Derived type to Base type requires explicit casting   
>        ________?-false_______    
>>

You got it!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-362-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:33:25 2003
Return-Path: <uhcosc1320-return-362-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5XN5Z1097678
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:33:25 -0500 (CDT)
Received: (qmail 20137 invoked by uid 108); 30 Jul 2003 05:38:03 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19111 invoked from network); 30 Jul 2003 05:36:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300531.h6U5VWEd1192623@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:31:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Exam topics? (fwd)
Status: O
X-UID: 357
Content-Length: 661
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>I am confused on what will be covered on the test.
> 
>We learned mutables right before jumping deep into inheritance, will it
>be included in midterm #2? 
> 
>Can we say our stopping point was everything talked about before
>INHERITANCE?
> 
>Thanks for your quick responses.
> 
>Best regards,

We have 

UML (to extent covered in class)
Function Overloading
Operator Overloading
Exception Handling

That's it. Do not worry about mutable for this one. We will cover that
one in midterm 3. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-363-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:37:44 2003
Return-Path: <uhcosc1320-return-363-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5bh5Z1198579
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:37:44 -0500 (CDT)
Received: (qmail 22862 invoked by uid 108); 30 Jul 2003 05:40:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16902 invoked from network); 30 Jul 2003 05:32:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300527.h6U5Rex81174285@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:27:39 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] An abstract/derived class???? (fwd)
Status: O
X-UID: 358
Content-Length: 2166
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>I just have 1 simple question: in class, you said that an abstract class can also be a derived one, did you means something like this?????
> 
>Let's use the codes you have written in class
> 
>#include "Dog.h"
>#include "Cat.h"
>#include "Horse.h"
>#include "HorseTypeOne.h"      //there's 2 different types of horses
>#include "HorseTypeTwo.h"
>#include "Train.h"
>void main()
>{
> 
>     Dog doggie;
>     Cat snow;
>     HorseTypeOne h1;
>     HorseTypeTwo h2;
>     
>     train(doggie);
>     train(snow);
>     train(h1);       //    these calls should make the 2 horse neighs differently
>     train(h2);      //
> 
>}
> 
>*Should I declare my Horse classes like this:
> 
>class Horse: public Animal                       
>{
>    public:
>            virtual void makeSound()                //overwrite the pure virtual function of Animal
>            {
>               neighs();
>            }
>            virtual void neighs() = 0;                //declare a new pure virtual function of Horse
>}
>
> 
>class HorseTypeOne:public Horse
>{
>    public:
>           virtual void neighs ()
>           {
>                 cout << "hiiiiiiiiiiiiiiiiiiiiiiiiiiiiii" << endl;
>           }
>}
> 
>class HorseTypeTwo:public Horse{
>    public:
>           virtual void neighs ()
>           {
>                 cout << "heeeeeeeeeeeee" << endl;
>           }
>} 
>* or should I do like this?
> 
>class Horse: public Animal  {}           //not overwrite the pure virtual function of Animal yet
> 
>class HorseTypeOne:public Horse
>{
>    public:
>           virtual void makeSounds()     //but wait until now then overwrite it
>           {
>                 cout << "hiiiiiiiiiiiiiiiiiiiiiiiiiiiiii" << endl;
>           }
>}
> 
>class HorseTypeTwo:public Horse {
>    public:
>           virtual void makeSounds()
>           {
>                 cout << "heeeeeeeeeeeee" << endl;
>           }
>}
>
>Which one is a better way, and why????

Good. Both of them are correct. 

Which one is better? I would pick six of one and half a dozen of the other.
(they both are fine really). Any advantage of one over the other is minor
in this example.

Venkat

From uhcosc1320-return-364-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 00:43:13 2003
Return-Path: <uhcosc1320-return-364-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6U5hC5Z1278517
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 00:43:13 -0500 (CDT)
Received: (qmail 29454 invoked by uid 108); 30 Jul 2003 05:47:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10068 invoked from network); 30 Jul 2003 05:21:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307300517.h6U5HC8H1162042@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 00:17:12 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] another midterm2 ? (fwd)
Status: O
X-UID: 359
Content-Length: 1348
X-Keywords: $NotJunk                                                                                           

>Ahhhh, but of course! Thanks.

Most welcome.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 07/29/03 03:29 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] another midterm2 ? (fwd)
>
>> 
>> >Sorry for the many questions but I have another question regarding
>question 6 of summer 2000. When you reach the code :
>>cout << comp.calc(-2) << endl;
>> the second time, the output is 
>>Timer Started 
>>Invalid number: -2
>>
>>Why doesn't the output produce the message "Timer Stopped" before the
>statement "Invalid number: -2"  
>>Thanks
>
>Look at the calc method:
>
>   	double calc(double number)
>   	{
>   	   	Timer* pTimer = new Timer();
>   	   	if (number < 0) throw number;
>
>   	   	double result = number * number;
>   	   	delete pTimer;
>
>   	   	return result;
>   	}
>
>If exception is thrown, the object created on the heap is never 
>deleted. That's why the destructor is not called.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-365-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 11:12:13 2003
Return-Path: <uhcosc1320-return-365-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UGCC5Z1209835
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 11:12:12 -0500 (CDT)
Received: (qmail 5357 invoked by uid 108); 30 Jul 2003 16:16:54 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21335 invoked from network); 30 Jul 2003 15:29:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301512.h6UFChAL773651@creek.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 10:12:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] old exam question (fwd)
Status: O
X-UID: 360
Content-Length: 562
X-Keywords: $NotJunk                                                                                           

>> >	  const Person& operator=(const Person& other){
>>=20
>> So what happend to the year of Birth?=20
>>=20
>> Bonus point for the first person to solve this issue correctly.
>
>I would say that since it is an operator=3D, which is just assignment, not
>a constructor, that it keeps the value it had.  It doesn't change.

Hummm, not the one I can buy.

The Bonus point is still out there for the taker!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-366-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 11:13:23 2003
Return-Path: <uhcosc1320-return-366-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UGDN5Z1211355
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 11:13:23 -0500 (CDT)
Received: (qmail 6608 invoked by uid 108); 30 Jul 2003 16:18:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21364 invoked from network); 30 Jul 2003 15:29:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301511.h6UFBoGL773629@creek.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 10:11:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Subject: [uhcosc1320] Midterm 2002 and 2001 Questions (fwd)
Status: O
X-UID: 361
Content-Length: 1425
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Can you please see if I have the following answers correct? Thank you for 
>your time! :)
>
>For Summer 2002 Midterm
>6. Give an example of an operator (other than =) that must be overloaded 
>using a member function. Show code.
>Is this right?
>char &operator[](int);

Sounds reasonable.

>10.What happens if an exception is left uncaught [1 pt]?
>
>Program crashes

I'll buy that.

>Given the code:
>
>void f1()
>{
>		X obj;
>		X* ptr = new X();
>
>		throw “error”;
>
>}
>
>what happens to the two objects created in this function [3 pts]?
>
>They are destroyed when the exception handler completes execution and exits.

Aaaah. The first object (obj) created on the stack is destroyed. 
The second one created on the heap is not.

>(c) You are worried that a function may throw an exception you do not 
>expect. How can you catch it still, if you do not know what it is throwing 
>[1 pt]
>
>
>catch(…)

Nope. 

catch(...)

>FOR SUMMER 2001 MIDTERM
>
>3. Give an example of an operator overloaded function that could be
>
>(a) member or global function [2]
>
>Date operator ++( );
>
>(b) member function only [2]
>
>char &operator[ ](int);
>
>
>(c) global function only [2]
>
>ostream &operator<<(ostream&, const String&);
>
>Thanks again! :)

Good job.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-367-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 11:14:31 2003
Return-Path: <uhcosc1320-return-367-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UGEU5Z1213722
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 11:14:30 -0500 (CDT)
Received: (qmail 7689 invoked by uid 108); 30 Jul 2003 16:19:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6419 invoked from network); 30 Jul 2003 16:17:52 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301613.h6UGD4DD1206603@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 11:13:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] uhcosc1320] old exam question (fwd) - Bonus Point Question (fwd)
Status: O
X-UID: 362
Content-Length: 642
X-Keywords: $NotJunk                                                                                           

>> >	  const Person& operator=(const Person& other){
>> 
>> So what happend to the year of Birth? 
>> 
>> Bonus point for the first person to solve this issue
>> correctly.
>> 
>> >	  m_pCar= other.m_pCar;
>> >          m_salary= other.m_salary;
>> >	  }
>
>Hi Dr. Venkat
>isnt const m_yearOfBirth already initialized in the
>construtor? We dont need to iniatialize it again in
>the operator = function.
>Hope this is correct.
>Regards

Hummm. Still waiting for the correct response!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-368-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 11:23:46 2003
Return-Path: <uhcosc1320-return-368-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UGNj5Z1238424
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 11:23:45 -0500 (CDT)
Received: (qmail 16024 invoked by uid 108); 30 Jul 2003 16:28:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12405 invoked from network); 30 Jul 2003 16:24:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301619.h6UGJVBN1375550@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 11:19:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] old exam question (fwd)
Status: O
X-UID: 363
Content-Length: 1128
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>
>My implementation for the Class Person is:
>public:
>    Person::Person( int yearOfBirth,Car* mCar, double salary)
>        :birthdate(yearOfBirth)
>    {
>        pCar = mCar;
>        income=salary;
>    }
>
>    Person::Person(const Person& other)
>        :birthdate(other.birthdate)
>    {
>        pCar = new Car(*other.pCar);
>        income = other.income;
>    }
>
>    const Person& Person::operator=( const Person& other)
>    {
>        if( this != &other )
>        {
>            delete pCar;
>            Person(*other);
>            
>        }
>        return *this;
>    }
>
>    Person::~Person() I tried to run it, every thing is fine.
>    {
>        delete pCar;
>    }
>};
>
>I tried to compile and run it, every thing is fine.  Would please help me 
>check if I missed somthing or if some code is not correct. Thank you very much.
>
>best regard.


The bonus point is still out there for the taker!!!!
I up the bonus to 2 points.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-369-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 11:25:18 2003
Return-Path: <uhcosc1320-return-369-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UGPI5Z1241448
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 11:25:18 -0500 (CDT)
Received: (qmail 17632 invoked by uid 108); 30 Jul 2003 16:30:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7581 invoked from network); 30 Jul 2003 15:14:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301509.h6UF9Qj7773609@creek.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 10:09:25 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Linking Error: unresolved external symbol (fwd)
Status: O
X-UID: 364
Content-Length: 772
X-Keywords: $NotJunk                                                                                           

>Venkat,
>I was playing with my code for assignment 2 in order to prepare for the exam
>I've run into a problem.  My code compiles, but it doesn't link.  I get the
>following message:
>
>IBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol
>_WinMain@16
>Debug/assign2.exe : fatal error LNK1120: 1 unresolved externals
>Error executing link.exe.
>
>It doesn't highlight any particular line of code, but I think this must have
>something to do with my code, and not my installation of C++.  Could you
>offer any help or ideas?  Here's my code.  Thanks.


Sure. When you created the project, by mistake you created it as
a Windows application. Recreate the project and make sure you create
it as console application. That should fix it.

>...deleted...

Venkat


From uhcosc1320-return-370-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 11:25:33 2003
Return-Path: <uhcosc1320-return-370-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UGPX5Z1245092
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 11:25:33 -0500 (CDT)
Received: (qmail 17940 invoked by uid 108); 30 Jul 2003 16:30:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9340 invoked from network); 30 Jul 2003 16:20:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301616.h6UGG0nM1213803@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 11:16:00 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] UML (fwd)
Status: O
X-UID: 365
Content-Length: 529
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>I am a little confused on the difference between the UML notation  for a class and the UML class diagram.  Is there any difference????  And what is required on  these diagrams?
>
>Thank You,


An UML class diagram shows classes and relationship between classes.
It contains UML notation for classes and notation for the relationship 
between the classes.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-371-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 11:26:48 2003
Return-Path: <uhcosc1320-return-371-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UGQl5Z1240696
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 11:26:47 -0500 (CDT)
Received: (qmail 19170 invoked by uid 108); 30 Jul 2003 16:31:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7553 invoked from network); 30 Jul 2003 15:14:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301507.h6UF7mn7773579@creek.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 10:07:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] exam ? (fwd)
Status: O
X-UID: 366
Content-Length: 1659
X-Keywords: $NotJunk                                                                                           

>Can you check if my UML class diagram for the class below is correct?  Thanks.
>
>class Person     
>{
>private:
>            Brain theBrain;
>            Heart* pHeart;
>            Person* pSpouse;
>public:
>            Person() { pHeart = new Heart(); }
>            ~Person( delete pHeart; }
>            void changeHeart(Heart* pNewHeart);
>            void marry(Person* pAnotherPerson);
>};
>
> 
>UML  class diagram:
>
>        ********************************************
>        *                 Person                   *
>        ********************************************
>        *                                          *
>        * - theBrain: Brain  (remove this)         *
>        * - *pHeart: Heart   (remove this)         *
>        * - *pSpouse: Person (remove this)         *
>        *                                          *
>        ********************************************
>        *                                          *
>        * + Person(): void                         *
>        * + ~Person():void                         *
>        * + changeHeart(*pNewHeart: Heart): void   *
>        * + marry(*pAnotherPerson: Person): void   *
>        *                                          *
>        ********************************************
>

Put a open (non-shaded) diamond and run a line from
Person to Heart. Put a shaded diamond and run a line
from Person to Brain. Put a (no-diamond) line from
Person to Person (this is the spouse relationship.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-372-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 11:27:04 2003
Return-Path: <uhcosc1320-return-372-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UGR35Z1247005
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 11:27:04 -0500 (CDT)
Received: (qmail 19547 invoked by uid 108); 30 Jul 2003 16:31:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8279 invoked from network); 30 Jul 2003 16:19:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301614.h6UGEnre1570197@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 11:14:49 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320]2002  midterm2  Q9 question (fwd)
Status: O
X-UID: 367
Content-Length: 5688
X-Keywords: $NotJunk                                                                                           

>Hi Dr. Venkat 
>How about below code? Will this work?
>
>//TimeOfDay.h Interface File
>class TimeOfDay
>{
>public:
>	TimeOfDay(unsigned int h, unsigned int m, unsigned
>int s);
>	TimeOfDay(const TimeOfDay& otherTime);
>	~TimeOfDay();
>	const TimeOfDay& operator=(const TimeOfDay&
>otherTime);
>	const TimeOfDay operator+ ( unsigned int s) const;
>	void getTime();
>	
>
>private:
>	unsigned int seconds;
>	unsigned int minutes;
>	unsigned int hours;
>	void SetTime( unsigned int h , unsigned int m ,
>unsigned int s)
>	{
>		hours = h;
>		minutes = m;
>		seconds = s;
>	}
>	void AddSeconds(unsigned int sec);
>};
>
>const TimeOfDay operator+(unsigned int s , const
>TimeOfDay& theTime);
>
>
>// TimeOfDay.cpp Implementation File
>#include"TimeOfDay.h"
>#include<iostream>
>using namespace std;
>
>
>TimeOfDay::TimeOfDay(unsigned int h, unsigned int m,
>unsigned int s)
>{
>	hours = h;
>	minutes = m;
>	seconds = s;
>// Avoid function call overhead when calling SetTime
>??
>}
>
>TimeOfDay::TimeOfDay(const TimeOfDay& otherTime)
>{
>	SetTime(otherTime.hours,otherTime.minutes,
>otherTime.seconds);
>}
>
>TimeOfDay::~TimeOfDay()
>{
>}
>
>const TimeOfDay& TimeOfDay::operator=(const TimeOfDay&
>otherTime)
>{
>	SetTime(otherTime.hours,otherTime.minutes,
>otherTime.seconds);
>	return *this;
>}
>
>const TimeOfDay TimeOfDay::operator+( unsigned int s)
>const
>{
>	TimeOfDay temp(*this);
>	temp.AddSeconds(s);
>	return temp;
>}
>
>
>void TimeOfDay::getTime()
>{
>	cout<<"hours "<< hours <<"Minutes "<< minutes <<
>"Seconds "<< seconds <<endl;
>}
>
>
>void TimeOfDay::AddSeconds(unsigned sec)
>{ 
>	 unsigned int totsec = (hours*3600 + minutes * 60 +
>seconds + sec) % 86400; 
>	 seconds = totsec % 60;
>	 minutes = ((totsec - seconds) % 3600) / 60;
>	 hours = (totsec - minutes * 60 - seconds) / 3600;   
>}
>
>
>const TimeOfDay operator+(unsigned int s , const
>TimeOfDay& theTime)
>{
>	TimeOfDay tempTime(theTime + s );
>	return tempTime;


Well, almost. 

How about simply

	retrun theTime + s;


>}
>
>
>
>
>--- "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>wrote:
>> >I didn't see that AddSeconds was defined private. 
>> There isn't anything defined as private for this
>> example.  If AddSeconds is private, how do you
>> suggest we get around this problem?  Thanks.
>> >
>> 
>> Any one who wants to take a stab at this one?
>> 
>> Venkat
>> 
>> >-------Original Message-------
>> >From: "Dr. Venkat Subramaniam"
>> <cosc155g@Bayou.UH.EDU>
>> >Sent: 07/29/03 12:03 PM
>> >To: COSC 1320 Mailing List
>> <uhcosc1320@agiledeveloper.com>
>> >Subject: [uhcosc1320] midterm2 question (fwd)
>> >
>> >> 
>> >> >For problem 9 of Summer 2002, can you check if
>> the following is correct,
>> >please?  Thanks.
>> >>
>> >>9.      Given a class  [10pts](No friends. Do not
>> provide functions to
>> >simply break encapsulation)
>> >>
>> >>class TimeOfDay { 
>> >>// Represents time on a 24 hours format 00:00:00
>> to 23:59:59
>> >>        unsigned int seconds, minutes, hours;
>> >>        
>> >>        void SetTime(unsigned int h, unsigned int
>> m, unsigned int s)
>> >>               { hours = h; minutes = m; seconds =
>> s; 
>> >>               // Assume errors checked here
>> >>               }
>> >>        void AddSeconds(unsigned int sec); 
>> >>public :
>> >> 
>> >>}; // End of Class interface
>> >>// Beginning of class implementation
>> >>void TimeOfDay::AddSeconds(unsigned sec)
>> >>               { 
>> >>                 unsigned int totsec = 
>> >>                   (hours*3600 + minutes * 60 +
>> seconds + sec) % 86400; 
>> >>                 seconds = totsec % 60;
>> >>                 minutes = ((totsec - seconds) %
>> 3600) / 60;
>> >>                 hours = (totsec - minutes * 60 -
>> seconds) / 3600;   }
>> >> 
>>
>>>/***********************************************************/
>> >>TimeOfDay::TimeOfDay(int h, int m, int s){
>> SetTime(h,m,s)}
>> >>
>> >>TimeOfDay::TimeOfDay(const TimeOfDay& other){
>> >>           hours=other.hours;
>> >>           minutes=other.minutes;
>> >>           seconds=other.seconds;}
>> >>TimeOfDay::~TimeOfDay(){}
>> >>String(const String& other);
>> >>
>> >>TimeOfDay operator+(const &TimeOfDay obj, const
>> unsigned &sec){
>> >>         TimeOfDay newTime= obj;
>> >>         newTime= newTime.AddSeconds(sec);
>> >
>> >AddSeconds is private. You can not call it from
>> this global method.
>> >
>> >>         return newTime;} 
>>
>>>/**************************************************************/
>> 
>> >> 
>> >> 
>> >>Write code in the space provided above to make the
>> following work:
>> >>void main()
>> >>{
>> >>        TimeOfDay noon(12, 0, 0);      // Noon
>> >> 
>> >>        TimeOfDay thirtypastnoon = noon + 1800;  
>> >>                                      // 1800
>> seconds after noon
>> >> 
>> >>        TimeOfDay fifteenpastnoon = 900 + noon; 
>> >>                                      // 900
>> seconds after noon
>> >>}
>> >>
>> >>
>> >>
>> >>thanks for your time.
>> >>
>> >
>> >
>> >
>> >Venkat Subramaniam
>> >--   	   	   	   	
>> >cosc155g@bayou.uh.edu   	   	Department of Computer
>> Science
>> >http://www.cs.uh.edu/~svenkat    	University of
>> Houston, Houston, Tx
>> >77204-3475
>> >> 
>> >
>> 
>> 
>> 
>> Venkat Subramaniam
>> --				
>> cosc155g@bayou.uh.edu		Department of Computer
>> Science
>> http://www.cs.uh.edu/~svenkat 	University of
>> Houston, Houston, Tx 77204-3475
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-373-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 11:31:51 2003
Return-Path: <uhcosc1320-return-373-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UGVp5Z1255230
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 11:31:51 -0500 (CDT)
Received: (qmail 24292 invoked by uid 108); 30 Jul 2003 16:36:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11227 invoked from network); 30 Jul 2003 16:22:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301618.h6UGI9JS1220908@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 11:18:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] midterm2 question (fwd)
Status: O
X-UID: 368
Content-Length: 1690
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>
>Q1:
>For the #9 in midter2 2002, I used a getAddSeconds function to help around 
>the private AddSeconds function. My program runs fine, would please help me 
>check if I have missed some thing, Thanks a lot for your time.
>
>functions in implemantation part for this problem:
>
>// as member funtions
>TimeOfDay::TimeOfDay(unsigned int h, unsigned int m, unsigned int s)
>    {
>        setTime(h,m,s);
>    }
>
>    void TimeOfDay::getAddSeconds(unsigned int val)
>    {
>        AddSeconds(val);
>    }

This is not correct.  If you can do this, wouldn't it make sense to simply 
make the AddSeconds public? But the question says not to do that.

>      TimeOfDay TimeOfDay::operator+(const unsigned int& val) const
>    {
>        Time result = *this;
>        result.AddSeconds(val);
>        
>        return result;
>    }
>
> // this is declared as a global funtion
>    TimeOfDay operator+(const unsigned int& val, const TimeOfDay& val2)
>    {
>        TimeOfDay result = val2;
>        result.getAdd(val);
>        return result;
>    }
>
>Q2:
>
>for the same exam #10 (b)
>void f1()
>{
>       X obj;
>       X* ptr = new X();
>       throw "error";
>}
>what happens to the two objects created in this function?
>my answer is:
>when the throw is executed, the object obj which created on the stack will be 
>cleared. but the object which the pointer ptr pointed to is created on the 
>heap will not be cleared.
>
>Would you please verifis my answer? realy appreciate you time.

I'm with you on this one.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-374-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 13:08:39 2003
Return-Path: <uhcosc1320-return-374-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UI8d5Z1501201
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 13:08:39 -0500 (CDT)
Received: (qmail 12100 invoked by uid 108); 30 Jul 2003 18:13:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7455 invoked from network); 30 Jul 2003 18:07:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301803.h6UI39br1424933@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 13:03:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] old mid term question (fwd)
Status: O
X-UID: 369
Content-Length: 2135
X-Keywords: $NotJunk                                                                                           

>The output is
>0022FF3C 100     <-- by Value
>0022FEFC 100
>0022FEFC 0
>004205C0 100
>****************
>0022FE5C 100     <-- by reference
>00420600 100
>00420600 0
>00420600 0
>
>Now, I think that catching an exception by value is wasting memory in stack.
>Also, rethrowing a change to an outer caught object are not propagated. 


Here is the output I got on bayou:

140004c00 100
11fffbff0 100
11fffbff0 0
140004c00 100
****************
140004c20 100
140004c20 100
140004c20 0
140004c20 0

>
>
>>You have a nested catch and a outer catch. You are trying to figure
>>out if catching by reference or by value in the inner class makes
>>a difference in terms of what happens when you throw.
>>Shoudn't the outer catch be by reference ;) hum hum.
>>
>>OK, do me a favor. Here is a modified code. Give this a try and
>>let me know what you think.
>>
>>Venkat
>>
>>// Modified code
>>#include <iostream>
>>using namespace std;
>>
>>class X
>>{
>>private:
>>    int i;
>>    public:
>>	X(int Val) 
>>	{ 
>>		i = Val; 
>>		display();
>>	}
>>	void display() const 
>>	{ 
>>	printf("%p %d\n", this, i);
>>	//cout << i << endl; 
>>	}
>>	void reset() { i = 0; }
>>};
>>
>>void main()
>>{
>>	try
>>	{
>>		try
>>		{
>>			throw X(100);
>>		}
>>		catch(X test1)     //catch by value
>>		{
>>			test1.display();  // display 100
>>			test1.reset();    // try to set it to 0
>>			test1.display();  // display 0
>>			throw;      // rethrow without conversion.
>>		}
>>	}
>>	catch(X& test1b)
>>	{
>>		test1b.display();        //display 100 again
>>	}
>>	cout << "****************" << endl;
>>	try
>>	{
>>		try
>>		{
>>			throw X(100);
>>		}
>>		catch(X& test2)   //catch by reference
>>		{
>>			test2.display();  // display 200
>>			test2.reset();    // set to 0
>>			test2.display();  // display 0
>>			throw;      // rethrow
>>		}
>>	}
>>	catch(X& test2b)
>>	{
>>		test2b.display();     //it will show 0 in this time. 
>>				     // Venkat's comment: Does it?
>>	}
>>
>>	cin.get();
>>}
>>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-375-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Jul 30 13:18:30 2003
Return-Path: <uhcosc1320-return-375-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6UIIU5Z1526056
	for <cosc155g@bayou.uh.edu>; Wed, 30 Jul 2003 13:18:30 -0500 (CDT)
Received: (qmail 20152 invoked by uid 108); 30 Jul 2003 18:23:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8513 invoked from network); 30 Jul 2003 18:09:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307301804.h6UI4I921486356@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 30 Jul 2003 13:04:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] in class examples (fwd)
Status: O
X-UID: 370
Content-Length: 778
X-Keywords: $NotJunk                                                                                           

>I noticed that in your example in yesterday, you had:
>#include <iostream>
>using namespace std;
> only in your Animal.h and nowhere else, not even in your main.  I thought that you needed it.  When I place it in the Dog/Cat/Horse.h it gives me an error at that location telling me this:
>error C2059: syntax error : 'namespace'
>error C2238: unexpected token(s) preceding ';'
>
>Can you explain why I don't need it in the other files? Thanks.

You can put that in any file you want (check the code you wrote for errors). 

I did not need it because all files are included from one .cpp that I have
which is main.cpp.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-376-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 31 10:20:18 2003
Return-Path: <uhcosc1320-return-376-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6VFKI5Z1125740
	for <cosc155g@bayou.uh.edu>; Thu, 31 Jul 2003 10:20:18 -0500 (CDT)
Received: (qmail 11427 invoked by uid 108); 31 Jul 2003 15:24:59 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9775 invoked from network); 31 Jul 2003 15:23:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307311518.h6VFIL9w1522902@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 31 Jul 2003 10:18:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Your wish
Status: O
X-UID: 371
Content-Length: 635
X-Keywords: $NotJunk                                                                                           

Yesterday some one "complained" that there were too many emails to read!
I said, if you like I will quit sending emails.

Well, I did not mean it when I said that. This morning, bayou
would not let me log on for over 4 hours! So, I could not
send any emails (you can imagine my frustration).

I am going to be in meetings most of the day today. I will try to
reply to some emails before the exam if I can, but I doubt if
I will get to several of those in my mailbox.

Regards,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-377-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 31 12:13:33 2003
Return-Path: <uhcosc1320-return-377-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6VHDX5Z1285351
	for <cosc155g@bayou.uh.edu>; Thu, 31 Jul 2003 12:13:33 -0500 (CDT)
Received: (qmail 16201 invoked by uid 108); 31 Jul 2003 17:18:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9658 invoked from network); 31 Jul 2003 17:11:22 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307311706.h6VH6RoU1262364@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 31 Jul 2003 12:06:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] question (fwd)
Status: O
X-UID: 372
Content-Length: 393
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>Q1:
>Exception handling reduces the need for strong type checking.
>Answer:
>False, because it enforces strong type checking.
>
>
>Would you please help me to clarify my answer? Appreciate for your time.

You are correct.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-378-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 31 12:14:04 2003
Return-Path: <uhcosc1320-return-378-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6VHE45Z1287550
	for <cosc155g@bayou.uh.edu>; Thu, 31 Jul 2003 12:14:04 -0500 (CDT)
Received: (qmail 16849 invoked by uid 108); 31 Jul 2003 17:18:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14815 invoked from network); 31 Jul 2003 17:16:58 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307311712.h6VHC3S01284123@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 31 Jul 2003 12:12:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] midterm 2 question (fwd)
Status: O
X-UID: 373
Content-Length: 534
X-Keywords: $NotJunk                                                                                           

>Can you please see if the following is true?
>
>a) inline functions is intended to make the program faster			_____T____
>(b) friend functions may be used instead of inline				____F_____
>(c) Only trailing arguments in a function may have defaults			_____T____
>(d) Ellipsis is C++ promotes flexibility and strong type checking 		____F_____
>
>
>
>thanks.
>

You got 'em all.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-379-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 31 12:26:13 2003
Return-Path: <uhcosc1320-return-379-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6VHQD5Z1323775
	for <cosc155g@bayou.uh.edu>; Thu, 31 Jul 2003 12:26:13 -0500 (CDT)
Received: (qmail 27526 invoked by uid 108); 31 Jul 2003 17:31:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11165 invoked from network); 31 Jul 2003 17:12:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307311708.h6VH83EU1276198@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 31 Jul 2003 12:08:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Project setting: /GR (fwd)
X-UID: 374
Status: O
Content-Length: 422
X-Keywords: $NotJunk

>I went under the project setting and then went to C/C++.  Are we suppose to type /GR in the common option box.  I tried and I was not able to.  Am I missing a step or in the wrong location?  Thanks.

Yes. Please ask this in class and I will show it to you again.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-380-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Jul 31 12:27:36 2003
Return-Path: <uhcosc1320-return-380-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6VHRZ5Z1322744
	for <cosc155g@bayou.uh.edu>; Thu, 31 Jul 2003 12:27:35 -0500 (CDT)
Received: (qmail 28879 invoked by uid 108); 31 Jul 2003 17:32:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13230 invoked from network); 31 Jul 2003 17:15:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307311710.h6VHAJdX1282158@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 31 Jul 2003 12:10:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] exam ? (fwd)
X-UID: 375
Status: O
Content-Length: 951
X-Keywords: $NotJunk

>> Put a open (non-shaded) diamond and run a line from
>> Person to Heart. Put a shaded diamond and run a line
>> from Person to Brain. Put a (no-diamond) line from
>> Person to Person (this is the spouse relationship.
>> 
>> Hi, Vankat
>
>for the about answer you gave, my question is do we need a arrow at the end 
>of line which point to Heart and Brain. also do we need arrow point to spouse.
>
>Thank you a lot.

Since that information is not available for the Heart and Brain, from what's 
shown in the code, I would not put the arrows for this questions. For
the spouse, it is bi-directional navigation and so there is no arrow.

However, from what's given, if you find that the navigation is 
allowed in one directional only, then I would put the arrow
in the direction of navigation.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-381-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 05:13:36 2003
Return-Path: <uhcosc1320-return-381-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71ADZ5Z1202437
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 05:13:36 -0500 (CDT)
Received: (qmail 2015 invoked by uid 108); 1 Aug 2003 10:18:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31019 invoked from network); 1 Aug 2003 10:12:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011007.h71A7bt81188446@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:07:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment 3 getCounterValue() question (fwd)
Status: O
X-UID: 376
Content-Length: 637
X-Keywords: $NotJunk                                                 

>Venkat,
>   In assignment 3, I am clueless about how to get assign3.cpp to get the value from the ModCounter function instead of the Counter function.  Was this Counter class function supposed to be "virtual int getCounterValue() const" instead of just "int getCounterValue() const"?  Could you give me a clue?
>

The count is being stored in the Counter and not the ModCounter isn't it?
So, even for a ModCounter obect, you should be getting it from the
Counter's get method.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-382-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 05:15:22 2003
Return-Path: <uhcosc1320-return-382-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71AFM5Z1174359
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 05:15:22 -0500 (CDT)
Received: (qmail 3319 invoked by uid 108); 1 Aug 2003 10:20:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32569 invoked from network); 1 Aug 2003 10:15:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011010.h71AADLl1186735@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:10:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Binding Litmus Test (fwd)
Status: O
X-UID: 377
Content-Length: 645
X-Keywords: $NotJunk                                                                                           

>Venkat,
>Would it be acceptable to summarize the Binding Litmus Test into one step by
>saying this?
>
>Binding is dynamic only when you call a virtual method on a reference or
>pointer.
>
>Thanks,

I will buy that, except for just one detail. The method need to be virtual in
the class of the type of the pointer or reference.  (It does not matter
if the method is virtual or not in any derived classes, what matters
is the class of the type of reference or pointer to decide binding).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-383-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 05:18:27 2003
Return-Path: <uhcosc1320-return-383-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71AIR5Z1213268
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 05:18:27 -0500 (CDT)
Received: (qmail 5274 invoked by uid 108); 1 Aug 2003 10:23:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17127 invoked from network); 31 Jul 2003 17:19:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307311714.h6VHE6SQ1285091@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 31 Jul 2003 12:14:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign3 (fwd)
Status: O
X-UID: 378
Content-Length: 446
X-Keywords: $NotJunk                                                                                           

>>From the course website containing the assignments, when I open the file ModCounter.cpp, inside it says #include "ModCounter.h".  Isn't it suppose to say  #include "Counter.h" because thats what it says in the ModCounter.h file.
>
>thanks.

You can modify this file any way you please.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-384-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 05:21:42 2003
Return-Path: <uhcosc1320-return-384-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71ALf5Z1213969
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 05:21:42 -0500 (CDT)
Received: (qmail 7349 invoked by uid 108); 1 Aug 2003 10:26:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2865 invoked from network); 1 Aug 2003 10:19:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011014.h71AEQIr1201552@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:14:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] default Operator= (fwd)
Status: O
X-UID: 379
Content-Length: 647
X-Keywords: $NotJunk                                                                                           

><html><div style='background-color:'><DIV>
><DIV>I know that the default operator= is worst than copy constructor because we not only have the problem of pointer conflict we also have memory leak. But is shallow initialization an appropriate term to use for a default operator= For example, is this statement true or false: </DIV></DIV>
><DIV>the default operator= performs shallow initialization?</DIV>

No, it is not. operator= does not perform initialization, it performs assignment.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-385-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 05:28:31 2003
Return-Path: <uhcosc1320-return-385-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71ASV5Z1244015
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 05:28:31 -0500 (CDT)
Received: (qmail 11670 invoked by uid 108); 1 Aug 2003 10:33:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4478 invoked from network); 1 Aug 2003 10:21:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011016.h71AGuQx1206045@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:16:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Your wish (fwd)
Status: O
X-UID: 380
Content-Length: 1481
X-Keywords: $NotJunk                                                                                           

>I'm actually greatful that there are so many emails.  They have 
>been very helpful, and have answered several questions that I've 
>had, before I could send them in.  I do appreciate the amount of 
>effort that you have put into helping us.  Thanks

Alright, get ready for one final week of the email!

:)

Venkat

>-----Original Message-----
>From: Dr. Venkat Subramaniam [mailto:cosc155g@Bayou.UH.EDU] 
>Sent: Thursday, July 31, 2003 10:18 AM
>To: COSC 1320 Mailing List
>Subject: [uhcosc1320] Your wish
>
>
>Yesterday some one "complained" that there were too many emails to 
>read! I said, if you like I will quit sending emails.
>
>Well, I did not mean it when I said that. This morning, bayou 
>would not let me log on for over 4 hours! So, I could not send any 
>emails (you can imagine my frustration).
>
>I am going to be in meetings most of the day today. I will try to 
>reply to some emails before the exam if I can, but I doubt if I 
>will get to several of those in my mailbox.
>
>Regards,
>
>Venkat Subramaniam
>--				
>cosc155g@bayou.uh.edu		Department of Computer Science
>http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 
>77204-3475
> 
>
>________________________________________________________________
>Sent via the EV1 webmail system at mail.ev1.net
>
>
> 
>                   
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-386-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 05:33:30 2003
Return-Path: <uhcosc1320-return-386-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71AXT5Z1246841
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 05:33:29 -0500 (CDT)
Received: (qmail 15063 invoked by uid 108); 1 Aug 2003 10:38:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6737 invoked from network); 1 Aug 2003 10:25:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011020.h71AKUEX1466252@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:20:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Whatif something goes wrong in try block? (fwd)
Status: O
X-UID: 381
Content-Length: 1235
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>Could you please clarify when something goes wrong in the try
>block, is there anything thrown at this point?
>
>For Example:
>
>On assignment#2 in the following function, let's say
> the string is empty,
>so no cahracter will be displayed, then what is agfter this on the
>exception handler?
>
>void printString(const String& stringObj)
>{
>  cout << stringObj << endl;
>
>  try
>  {
>    cout << "first char in the string is " << stringObj[0] << endl;
>  }
>  catch(OutOfRange& exceptionObj)
>  {
>    cout << exceptionObj.getError() << endl;
>  }

Once a catch handles an exception, if it does not (re) throw,
the program will continue at that point (by passing any
other catches that sites next to the catch that handled it,
leave that try block. So, in this example:


try
{
	foo();
	code A;
}
catch(Exception& e)
{
	code 0;
}

code1


If foo throws an exception of type Exception, code A is skipped.
code 0 is executed and then code 1.

>Thank you so much for all the effort and extra time you dedicate
>to all of us.
> .......
>

You are most welcome.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-387-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 05:36:46 2003
Return-Path: <uhcosc1320-return-387-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71Aak5Z1258862
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 05:36:46 -0500 (CDT)
Received: (qmail 17163 invoked by uid 108); 1 Aug 2003 10:41:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14158 invoked from network); 1 Aug 2003 10:36:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011032.h71AW0rM1252740@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:32:00 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubt Regarding Inheritance (fwd)
Status: O
X-UID: 382
Content-Length: 3069
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>        
>     I have a doubt regarding the 'Animal' inheritance example you explained in monday's class.
> 
>_________________
> 
>Dog.h
>_________________
> 
>include "Animal.h"
>class Dog : public Animal
>{
> //int* p; // Try uncommenting this line
>public:
>  Dog()
>  {
>    //p = new int;  // Try uncommenting this line
>  }
>  void bark()
>  {
>    //*p = 27;  // Try uncommenting this line
>    cout << "bow wow" << endl;
>  }
>};
>_________________
> 
>Train.h Code :
>__________________
> 
>void train(Animal& anAnimal)
>{
> anAnimal.eat();
> Dog* pDog = (Dog*) &anAnimal;
> pDog->bark();
>}
> 
>______________________
>main.cpp code
>______________________
> 
>#include "Dog.h"
>#include "Cat.h"
>#include "Train.h"
>void main()
>{
> Dog doggie;
> Cat snow;
> train(doggie);
> train(snow);
>}
> 
> 
>In the above code when you called 'Train' function on 'doggie' and 'cattie' , the output was:
> 
>Animal eating
>bow wow
>Animal eating
>bow wow
>Press any key to continue
> 
>This output was when we commented the pointer in 'Dog.h' code.
> 
>My question is,when 'doggie' was passed to 'Train'  then 'pDog  pointer' points to Dog animal and everything was fine.But,when 'cattie' was passed to 'Train' then 'pDog' pointer will point to 'Cat'.Then how come the output showed 'bow wow' even for cat when there was no bark() method on cat.
>I remember you saying something like objects and methods are different(I am not sure).
>Actually i didn't understand what you said.
> 
>Could you please clarify sir.
> 
>Thanks and Regards.

OK, I will reveal a little secret. In object oriented systems, you call methods on objects.
But what does it mean really by calling methods on objects? Here is what is happening when 
you call methods.

Let's say you have 

class A
{
private:
	int val;
public:
	...
	void f1(int a) 
	{
		val = val + a;
	}
};

int f2(int a)
{
	return a + a;
}

Now, if I call 

int v = 4;
f2(4);

f2 simply takes a variable a and uses it. This we understand from procedural code.

However, if I say

int v = 4;
A obj;
obj.f1(v);

Now, f1 called on obj. Within f1, it interacts with both obj and copy of v, which is a.

Now, how does this really work?

What happens under the hood is logically as follows. f1 takes a hidden, invisible parameter of type 
A*. So, f1 is a member function right. It actually behaves like a global function with the following
signature:

void f1(A* pInvisibleParameterThis, int a)
{
	pInvisibleParameterThis->val = pInvisibleParameterThis->val + a; 
}

and when you call 

obj.f1(a);

The compiler understands it as

f1(&obj, a);

You get the idea?

Now, in the Dog, Cat, Animal example, when you call bark, it takes a invisible pointer to
Dog (which by error we pass the pointer to Cat in the second instance of the call).
But the bark does not really use any methods or members of the Dog object passed in and so
had no errors and it simply barked (even though Cat was passed, which I should say as
even though literally called on Cat).

Are you more comfortable with this now? Good question.

Venkat

From uhcosc1320-return-388-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 05:54:28 2003
Return-Path: <uhcosc1320-return-388-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71AsR5Z1276811
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 05:54:27 -0500 (CDT)
Received: (qmail 28176 invoked by uid 108); 1 Aug 2003 10:59:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24640 invoked from network); 1 Aug 2003 10:53:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011048.h71AmilV1293723@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:48:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign3 (fwd)
Status: O
X-UID: 383
Content-Length: 2675
X-Keywords: $NotJunk                                                                                           

>I have a question concerning assignment 3.  I'm trying several things
>for the operator++/--, and they aren't quite doing what I need them to
>do.  First, I can't return ModCounter, because my compiler doesn't allow
>covariant return types.  Is this okay, or should I use a compiler that
>does?

Let's say we have

class A
{
public:
	virtual A& foo() 
	{
		return *this; // You are returning object of A
	}
};

class B : public A
{
public:
	virtual B& foo() 
	{
		return *this; // You are returning object of B
	} 
	
	This is not valid. The return type when you override must be the same.
	However, the following is valid:

	virtual A& foo() 
	{
		return *this; // You are returning object of B
	} 

	Note that you are still returning an object of B from here, but the type is
	A reference. Think about the person who calls foo on a pointer of reference of
	type A. They want to get a reference to A, even if it was polymorphically 
	executed on object of B. The object itself may be A or B, but type of reference is
	A. 
	// User of A
	// void user(A& ref)
	// {
	// 	A& r = ref.foo();
		
			Here, r will refer to either object of A or object of B depending on what
			ref refers to.
	// }
};

>So, I've tried different things, but I can't seem to get past the fact
>that value is private to Counter.  I can't increment it, but I can call
>Counter::operator++(), and ditto operator--.  However, because I can't
>access value.  I sure don't want to call reset() and have to increment
>many times depending on the limit if I decrement past 0.  That would be
>really inefficient (O(n) I believe). =20

Your thinking is on the right line. I will let you proceed further and
you will see the solution for it from what I have said above and
what you have said above as well.

>I've tried some really funky things, using dynamic_cast<> to get a
>Counter object, but it still didn't compile.  

Thank goodness it didn't :).

>I even tried to take that
>pointer, and cast it to an int*, and try to increment that, but that
>caused a sigsegv.  I just can't seem to get around the private data.

Do not try to break encapsulation. Work with it.

>Maybe I'm looking at something wrong?  I'm still trying, looking at all
>alternatives, but maybe I'm just stuck in a rut.
>
>Is there anything in particular you can tell me?  Any specific direction
>I should be looking?  Maybe I'm way off and should be doing something
>else altogether?
>
>
>Thanks.

Let me know if the discussion above has helped you or if you are still stuck.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-389-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 05:55:11 2003
Return-Path: <uhcosc1320-return-389-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71AtB5Z1309100
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 05:55:11 -0500 (CDT)
Received: (qmail 28761 invoked by uid 108); 1 Aug 2003 11:00:02 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26355 invoked from network); 1 Aug 2003 10:56:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011051.h71Ape261293841@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:51:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign3 again (fwd)
Status: O
X-UID: 384
Content-Length: 601
X-Keywords: $NotJunk                                                                                           

>This is a continuation of my last email.
>
>I am able to implement operator++ by calling Counter::operator++(), then 
>using getCounterValue() to find if the value is >= the limit, then call 
>reset(), but that doesn't quite work for operator--().
>
>Just trying to figure this out...

That's good to hear that. It is going to be some what messey,
but remember not to break any encapsulation. Work with the
interface provided by the Counter.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-390-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 06:01:13 2003
Return-Path: <uhcosc1320-return-390-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71B1D5Z1320988
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 06:01:13 -0500 (CDT)
Received: (qmail 361 invoked by uid 108); 1 Aug 2003 11:05:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25338 invoked from network); 1 Aug 2003 10:54:47 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011049.h71Annco1282555@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:49:49 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Exception by reference vs. by value???? (fwd)
Status: O
X-UID: 385
Content-Length: 385
X-Keywords: $NotJunk                                                                                           

>Hi Venkat, can you explain again the advantage of catching an exception by reference instead of by value????
>Thanks.

By reference eliminates the call to copy constructor and destructor overhead (at least on some
compilers).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-391-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 06:05:01 2003
Return-Path: <uhcosc1320-return-391-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71B505Z1330776
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 06:05:01 -0500 (CDT)
Received: (qmail 2960 invoked by uid 108); 1 Aug 2003 11:09:46 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27681 invoked from network); 1 Aug 2003 10:58:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011053.h71ArQsG1297472@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:53:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Last Assign (fwd)
Status: O
X-UID: 386
Content-Length: 476
X-Keywords: $NotJunk                                                                                           

>Venkat,
>I was wondering if it is possible to make the last assignment due on Monday 
>the 11th at midnight.
>It will give us some extra time to work on it.
>

My hands may be tied on this one. I need to find out when the University 
needs the grades. I will give you the maximum time possible once I 
find this out.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-392-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 06:10:44 2003
Return-Path: <uhcosc1320-return-392-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71BAh5Z1339560
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 06:10:43 -0500 (CDT)
Received: (qmail 6346 invoked by uid 108); 1 Aug 2003 11:15:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3866 invoked from network); 1 Aug 2003 11:11:17 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011106.h71B6JF81337772@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 06:06:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Error Overriding virtual functions (fwd)
Status: O
X-UID: 387
Content-Length: 1062
X-Keywords: $NotJunk                                                                                           

>In your Counter.h you have:
>virtual Counter operator++();
>
>In my ModCounter.h, I declared:
>virtual ModCounter operator++();
>
>I get an error:
>c:\files\projects\counter\modcounter.h(12) : error C2555: 'ModCounter::++' : 
>overriding virtual function differs from 'Counter::++' only by return type 
>or calling convention
>
>What's worng?  Should I be getting this error?  I always assumed that you 
>could return whatever type you wanted when you were overridding a virtual 
>function.  I'm using MS Visual C++ 6.0.

I just sent another email this morning related to this. Please read that one.

>Also, I have run into a problem that seems solvable only by using casting.  
>May we use casting in this project?
>
>Thanks,

Think several times and use it only if there is no choice.
(Hint, you may actually need dynamic cast at some place in 
this assignment, but not the regular brute-force cast).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-393-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 06:12:50 2003
Return-Path: <uhcosc1320-return-393-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71BCn5Z1346209
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 06:12:50 -0500 (CDT)
Received: (qmail 7761 invoked by uid 108); 1 Aug 2003 11:17:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1954 invoked from network); 1 Aug 2003 11:08:11 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011103.h71B3DZ81324045@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 06:03:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubt Regarding Protetcted Inheritance (fwd)
Status: O
X-UID: 388
Content-Length: 2514
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>   I did not quite understand the difference between 'private inheritance' and 'protected inheritance'.Could you please clarify my doubt.
> 
>And coming to the number of mails there is no problem at all even if we get more mails from nowon.Your mails help a lot.
> 
>Thanks and Regards.
>

Alright, let's first understand the meaning of these words and then look at an example. 

public inheritance - a class "tells" every one that it inherits from its base.
private inheritance - a class "tells" no one that it inherits from its base. (the class itself knows
			that it is inheriting however).
protected inheritance - a class "tells" only its derived classes that it inherits from its base. 
				(the class itself knows that it is inheriting however).

Now, depending on where you are, things make the difference.

void foo(A& obj) {...}
//foo is a global function.

class A {};

class B : WHATISIT A
{
public:
	void f()
	{
		foo(*this); // This will always compile irrespective of WHATISIT being public, private
		// or protected. Reason - B always knows that it inherits from A and so from within
		// B, I can treat this object of B as also on object of A.
	}
};

void globalFunction()
{
	B obj;

	foo(obj); // When will this be possible. Only if main knows that B inherits from A.
	// when will main/global know if B inherits from A. Only if WHATISIT is public.

	// NOTE A:
	// This will not compile if WHATISIT is private or protected.
}


class C : public B // C inherits from B. The discussion here does not depend how C inherits from B.
{
public:
	void someFunction()
	{
		foo(*this); // When will this compile. Only if C knows that it inherits - indirectly -
		// from A. But, how will C know this. Only if B tells to C that it inherits from A.
		// B will tell that it inherits from A only if WHATISIT is public or protected.

		// NOTE B:
		// This will not compile if WHATISIT is protected.
	}
};

See the difference in Note A and Note B. Hope this helps clarify this.

Again, the only inheritance that makes much sense is public inheritance. private and protected
inheritance have little advantage, except in some advanced design techniques. Largely, I will
leave these to the judgment of an experienced C++ developer. So, do not use these much until
you are very comfortable and see a situation that has compelling benefit.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-394-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 06:55:26 2003
Return-Path: <uhcosc1320-return-394-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h71BtP5Z1453742
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 06:55:25 -0500 (CDT)
Received: (qmail 324 invoked by uid 108); 1 Aug 2003 12:00:07 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19675 invoked from network); 1 Aug 2003 10:45:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308011040.h71AeMN01256614@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 05:40:22 -0500 (CDT)
Cc: jqchen@cs.uh.edu (Jinqiang Chen)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Doubt Regarding Homework-2 (Just A Small Clarification) (fwd)
Status: O
X-UID: 389
Content-Length: 3141
X-Keywords: $NotJunk                                                                                           

Jin,

I apologize for any confusion. Sorry, I suggest NO POINTs be give for this.

I think the answer was misinterpreted from my mail you
have referred to.

At the bottom I have incldued an email I sent to the class.
Please note what it says. Putting the rIncome and
pCar in the initialization list is correct.
But, look at the reasoning not to put it also. So based
on the reason given, even though it is "correct" or "OK" to put
these in the initialization list, one should not. 

Please read my other email on this subject at the end
of this email.

Regards,

Venkat

>Hi, Venkat:
>
>A few students came to my office today and pointed out that the placement
>of rIncome in the initialization list is correct according to this mail.
>They've got 1 point deducted on HW2 because their rIncome was initialized
>in the I.L.
>Could you send this to mailing list to tell students to come to my office
>to revise their grade during office hour?
>Thanks.
>
>Jin
>
>On Sat, 26 Jul 2003, Dr. Venkat Subramaniam wrote:
>
>> >Hello Venkat,
>> >
>> >Sorry for asking a doubt on homework-2 now.In question-2 of homework-2, i think
>> >name, brain and birthdate "should" be placed in the initialization list.And coming to income and pCar, both are optional as they can be placed either in initialization list or in the body of Person's constructor.Hope i am correct.Could you please clarify.
>> >
>> >Thanks and Regards.
>>
>> I think the placement of each of this you have mentioned is correct.
>>
>> Venkat Subramaniam
>> --
>> cosc155g@bayou.uh.edu		Department of Computer Science
>> http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475


->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->

This was sent to the class...

1. Here is what I would do for the constructor of Person in HW2:

Person(const char* rName, long dateOfBirth, int iq, int rIncome)
: name(rName), brain(iq), birthdate(dateOfBirth)
{
	pCar = new Car(); // Or pCar = 0;
	income = rIncome;
}

2. Why I would use the initialization list for each member on the 
	initialization list

Since String and Brain do not have a constructor that takes no 
arguement, I am forced to initialize these in the initialization
list. Further, initializing objects in the initialization list
is more efficient than assigning them values in the constructor,
since assignning them in the constructor requires additional
method call.

I have to initialize the birthdate here as well since it is a
const and it can not be assigned a value within the constructor.

3. why I am not using the initialization list for each
 member not on the initialization list

pCar is just a pointer. If I do not initialize it, there is no
overhead. I will imply assign it a value in the constructor to
either a Car pointer or simply to null (0). Similarly,
not initializing income has no overhead and I will assign 
it a value in the constructor. 

While I could put these two in the initialization list, putting
them in the constructor improves readability of code and so I
choose to do it that way.

->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->->

From uhcosc1320-return-395-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 23:08:07 2003
Return-Path: <uhcosc1320-return-395-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h724865Z1246808
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 23:08:07 -0500 (CDT)
Received: (qmail 27777 invoked by uid 108); 2 Aug 2003 04:13:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12936 invoked from network); 2 Aug 2003 03:44:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308020339.h723drK31177823@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 22:39:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Project properties settings (fwd)
Status: O
X-UID: 390
Content-Length: 3289
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>How do I set up the dynamic_cast keyword to function on my system.  I am using Visual Studio 6.0.
>
>I went to Project Settings and then to C/C++ and then added / GR in the bottom window called Project Options.  However, it is not working.  There was another email about this and you said to ask in the next class which was yesterday.  I either was catatonic when you illustrated this procedure again or  you did not show it again.  I do not remember you going over it again.  What am I missing?
>

Since no one asked about this, I assumed the person who asked this question
figured out the answer and did not need me to revisit in class.

Here are the steps to follow:

1. Click on Project menu and select Settings menu item.
2. Click on C/C++ tab in the dialog.
3. In the Project Options text box, scrolldown to the bottom.
4. (On my system, the last entry is /c) At the very end type /GX (make
sure to give space before /GX)

Note, after you enter /GX, if you revisit this dialog, the /GX will
not be at the end. It is rearranged among the several parameters in
that text box. Then click on Build, Rebuid All to do a full 
rebuild.

>I have another question.  I realize I can not access private variables of my base class from my derived class, but everything I try keeps blowing up in my face.  I am obviously not understanding this at all.  How am I suppose to increment my derived class objects?  I have include parts of my code I believe to be involved.  Maybe this will help you get me on the right track.
>
>... deleted...
>	if (this->getCounterValue == limit - 1)

There are two problems with the code above.

1. I hate using this-> to call methods. This is a bad practise.
2. You are missing the () at the end of the method name. You need to
call getCounterValue() with the () as shown here.

// I have tried this no luck.  I have tried Counter::getCounterValue no luck.  This gives me and error saying the "=" can not convert what is on the left to what is on the right.  I have tried making a pointer to an object of Counter no luck.
>
>...deleted...
>
>The first function is the only one I have worked on so far to correct what ever is going on.  I understand the rest are wrong for the same reason the first one is.  I can not access value directly.  I have tried to figure out what is going on using the book and my notes and examples.  I am missing something.
>

You have to work with the methods available in the base class to
implement what you need in the derived class. You can not
break the encapsulation. You are heading in the right directions.
You got a few things to watch out though. Do not mess with the count
in the derived class. The base class has the counter value and let 
it have it. Simply use it from the base.

If you want to call a method of a base from the method of the derived,
you will use the Base:: notation. For example, if foo is virtual a method
in base, and foo is overridden in derived, then in the derived foo, you
would write


virtual Derived::foo()
{
	...code...

	Base::foo(); // You are invoking the services of the Base foo here.

	...code...
}

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-396-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 23:10:28 2003
Return-Path: <uhcosc1320-return-396-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h724AS5Z1242885
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 23:10:28 -0500 (CDT)
Received: (qmail 29199 invoked by uid 108); 2 Aug 2003 04:15:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7315 invoked from network); 2 Aug 2003 03:33:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308020328.h723SvjS1146227@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 22:28:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Class Inheritance question, non-related (fwd)
Status: O
X-UID: 391
Content-Length: 1616
X-Keywords: $NotJunk                                                                                           

>Venkat,
>    I understand where I need to go now because of this email and others, but I just have one overall question about this.
>
>if I have
>
>class A
>{ int a; };
>class B : public A
>{ int b; };
>class C : public B
>{ int c; };
>....
>class Z : public Y
>{ int z; };
>
>Is it correct to say that when you initialize an object of Z, it also creates variables and functions from A->Y?  Wouldn't this slow down a system if you use inheritance to an extent like this?  Have you ever been in a real situation similar to this?
>
>Thank you very much for your time, now and in the past!
>Very appreciated!

There is not time spent in creating methods or functions. Methods/functions
are not created for each object. So, only time spent is in creating
and giving values to variables. 

If you did not need some information in a procedural code, then you
do not need that information in the object oriented code either. 
In otherwords, it takes time alright, but that is what the
complexity of a system demands. Further, C++ and most of the modern
languages are fairly efficient in that they are fairly optimized and
give the best performance possible. 

I have worked with large scale systems - with hundreds of classes and
thousands of objects - and performance has not been the most concern
at all. There were always other issues like concurrency, security,
mantainability, keeping up with change in requirements  that took
most attention.

Good question.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-397-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 23:13:59 2003
Return-Path: <uhcosc1320-return-397-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h724Dw5Z1245555
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 23:13:58 -0500 (CDT)
Received: (qmail 31247 invoked by uid 108); 2 Aug 2003 04:18:53 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19156 invoked from network); 2 Aug 2003 03:56:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308020351.h723pVxp1202484@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 22:51:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Homework 2 question (fwd)
Status: O
X-UID: 392
Content-Length: 940
X-Keywords: $NotJunk                                                                                           

><DIV>I remember you told me in class that efficiency is not effected for primitive types, but in homework2 we have a pointer of type Car, which is not a primitive type. 

The pointer is provitive type. The Car is not primitive, but
all pointers are primitive in nature.

> So will efficiency be effected in this case, will the compiler first initialize the pointer with junk value and then assign it the value that is in the body of the constructor, i.e. 0 or new Car.</DIV>
><DIV>&nbsp;</DIV>
><DIV>Thanks</DIV>

Pointers and other primitive types are not initialized to any thing
in C++. They are left uninitialize (left to what ever garbage they
have). So, there is no advantage to initializing these in the
initialization list, unless you are required to due to say constness.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-398-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 23:17:36 2003
Return-Path: <uhcosc1320-return-398-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h724HZ5Z1257954
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 23:17:35 -0500 (CDT)
Received: (qmail 765 invoked by uid 108); 2 Aug 2003 04:22:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16116 invoked from network); 2 Aug 2003 03:50:45 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308020345.h723jiX51095799@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 22:45:44 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] m1 = m2++, is it posible? (fwd)
Status: O
X-UID: 393
Content-Length: 1308
X-Keywords: $NotJunk                                                                                           

>I have gotten my code to work with your source and give the desired output.  

Way to go Tiger.

>I even tested it with quite a bit of my own code and it seems to do 
>everything just fine EXCEPT the following:
>
>ModCounter m1(4);
>ModCounter m2(4);
>m1 = ++m2;
>//Or:
>m1 = m2++;
>
>I get a compile error b/c operator++ returns a Counter and operator= takes a 
>ModCounter.
>I tried writing a ModCounter::operator=(const Counter&), but this failed for 
>obvious reasons.
>I can't have operator++ return a ModCounter b/c your operator++ returns a 
>Counter.

Good points. By the way, two things I want to say here. One
writing ModCounter::operator=(const Counter&) will not solve the
problem you are talking about here. Having said that, that function 
may be needed for other purposes. I will leave it at that for you
to think further about.

>Must my program support operations like the one above?
>If so, do you have any tips or hints as to how to implement it?
>
>Thanks,

You are right on the money. The increment should work fine. But the
assignment of the result from ++ is the sticky part here.  I don't think
much can be done about this. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-399-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 23:18:11 2003
Return-Path: <uhcosc1320-return-399-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h724IB5Z1264696
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 23:18:11 -0500 (CDT)
Received: (qmail 1255 invoked by uid 108); 2 Aug 2003 04:23:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7731 invoked from network); 2 Aug 2003 03:34:48 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308020329.h723Tmap1094264@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 22:29:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Hw3, Hw4, & Assign4 ??? (fwd)
Status: O
X-UID: 394
Content-Length: 349
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>
>  Are we going to finish HW3, HW4, and Assig4 in next week?  BTW, when do we have the HW3 & HW4?
>
>regards,

Yep. You will clearly see the email message when they are posted.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-400-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 23:22:08 2003
Return-Path: <uhcosc1320-return-400-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h724M85Z1268750
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 23:22:08 -0500 (CDT)
Received: (qmail 3421 invoked by uid 108); 2 Aug 2003 04:27:03 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26940 invoked from network); 2 Aug 2003 04:11:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308020406.h7246MG81238232@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 23:06:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 3 interface confusion (fwd)
Status: O
X-UID: 395
Content-Length: 2825
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>I have having serious trouble understanding inheritance. If I create a
>ModCounter, it has access to all the [public] functions in its base
>class, Counter. However, does a "true" Counter class instance exist? It
>is confusing me because I can call all the public functions but, where
>is the instance? Is it "this" ? if my conjecture is false, then my other
>hypothesis is to create a Counter class within the ModCounter class. But
>that's kind of weird, to aggregate a base class within a derived class.
>This notion seems to be redundant or even ironic in the paradigm of
>polymorphism when the aggregation is sort of assumed when one inherits
>something. 
>
>So I guess the main question is.. do I have an instance of Counter
>within an instance of ModCounter? Or do I have to declare a separate
>Counter class?
> 
>Thanks;

This is a very important and a very good question.

An object of a derived class is an object (itself) of two (or more)
classes - that of derived and also that of base.

For example, let's say there is a room and Jimmy is the only one
sitting in that room. If I ask you how many men are in the room, 
you would say one. Now, if I ask, how many humans are in that room,
the answer again is one as well, isn't it. Jimmy is both a Man
and a human at the same time. 

Let's say we have a class A.

class A
{
private:
	int v1;
	int v2;
};

If I were to create an object of A, it's size would be 8 bytes
(actually, its size is 12 bytes - 4 extra bytes are needed for
VPtr, polymorhism implementation as we will learn on Monday, but let's ignore
that for now).

Now, let's assume, we create a class B

class B : public A
{
private:
	int v3;
};

While B itself needs only 4 bytes, it will also need to hold the 
values for data from the A part of the object. The total size of
the B object will be 12 bytes (again, in reality will be 16 bytes,
but let's ignore that again).

Now, if I write,

A objA; // Size is 8 bytes. (ignoring the 4 bytes for VPtr)
B objB; // Size is 12 bytes (ignoring the 4 bytes for VPtr)

A* p1 = &objA; // Fine, isn't it.
B* p2 = &objB; // Fine again.

A* p3 = &objB; // You see, this is fine as well. You want to look at
	// objB as if it is an instance of A (and it is instance of
	// A as well).

B* p4 = (B*) &objA; // ***** This is not correct. ObjA is only an
	// object of A and not an object of B.

In memory, for an object of B (objB), the data for A part is piggy backed
on the data of B part. In other words, congigous memory is allocated
for this objB with the data defined in A first and followed by the data 
defined in B.

Did this help in any way? Are you more comfortable or more confused?

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-401-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  1 23:30:42 2003
Return-Path: <uhcosc1320-return-401-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h724Uf5Z1132744
	for <cosc155g@bayou.uh.edu>; Fri, 1 Aug 2003 23:30:42 -0500 (CDT)
Received: (qmail 8223 invoked by uid 108); 2 Aug 2003 04:35:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17701 invoked from network); 2 Aug 2003 03:53:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308020348.h723moWl1197566@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 1 Aug 2003 22:48:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problem Decrementing past 0 (fwd)
Status: O
X-UID: 396
Content-Length: 1346
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I still don't know how to turn on the keyword dynamic_cast?

Hopefully the email sent out a few minutes ago will answer that
for you.

>My problem with my decrementing is that I don't see how to change the integer in the variable value with out setting up a loop and incrementing to the limit.  There is no function that allows a change in state greater than 1.  (i.e. no set function)  Creating a new object of Counter will not do it either; since, the object is set to zero in the constructor.  The operator= overloaded function will not work either because it only works on the variable in which the function is run.  I am stumped, what is the error in my thinking?

Doesn't this show us that it is not easy to take some class and
suddently inherit from it. This hopefully drive home the point that
it takes some effort to design a class for inheritance and if it
is not built fully to support it, it is not easy to implement.

One solution to this specific problem is for the base class (Counter)
to have a protected method that allows you to set the value. However,
Counter does not have such a method. You may not have very many options
than what you have stated above.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-402-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 08:51:50 2003
Return-Path: <uhcosc1320-return-402-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72Dpn5Z1094240
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 08:51:50 -0500 (CDT)
Received: (qmail 11096 invoked by uid 108); 2 Aug 2003 13:56:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7282 invoked from network); 2 Aug 2003 13:49:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021344.h72DiHma1090834@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 08:44:17 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] copy constructor and operator= (fwd)
Status: O
X-UID: 397
Content-Length: 1079
X-Keywords: $NotJunk                                                                                           

>Venkat, is it legal to call Counters operator= in ModCounter's copy 
>constructor and operator= to assign the value of other to "this". 
> I was thinking of doing that so I can assign values without breaking the 
>encapsulation
>
>Thanks

While it is legal, I would prefer calling the copy constructor of the
base from the copy constructor of the derived and the operator= of the 
base from the operator= of the derived.

To call the copy constructor of the base, you do the following:

Derived::Derived(const Derived& other) : Base(other)
{
	... any other stuff that you need to do as part of derived ...
}

Derived::operator=(const Derived& other)
{
	Base::operator=(other);
	... any other stuff that you need to do as part of derived ...
}

With respect to operator= for the derived, there is another small "carrot." 
You will hopefully figure that one out soon. Think about things we spoke in
the class on Thursday!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-403-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 08:54:51 2003
Return-Path: <uhcosc1320-return-403-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72Dso5Z1103310
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 08:54:51 -0500 (CDT)
Received: (qmail 12728 invoked by uid 108); 2 Aug 2003 13:59:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8548 invoked from network); 2 Aug 2003 13:51:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021346.h72DkvZf1092758@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 08:46:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] keyword dynamic_cast in Bayou (fwd)
Status: O
X-UID: 398
Content-Length: 461
X-Keywords: $NotJunk                                                                                           

><html><div style='background-color:'><DIV>Hi Venkat</DIV>
><DIV>How do you turn the keyword dynamic_cast on in Bayou</DIV>
><DIV>Thanks</DIV>

There are no flags needed to turn on dynamic_cast in the GNU compiler
on bayou. You can simply use it and it figures out if you are using
dynamic_cast or not.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-404-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 08:58:40 2003
Return-Path: <uhcosc1320-return-404-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72Dwe5Z1122050
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 08:58:40 -0500 (CDT)
Received: (qmail 15003 invoked by uid 108); 2 Aug 2003 14:03:31 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12277 invoked from network); 2 Aug 2003 13:58:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021353.h72DrpQx1110015@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 08:53:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Help on Overriding the operator++() (fwd)
Status: O
X-UID: 399
Content-Length: 2054
X-Keywords: $NotJunk                                                                                           

>hi Venkat,
>
>I read your e-mail about how to override virtual methods in
>base class to implement them on the derived class,  but I still
>get an error
>
>Compiling...
>assign3.cpp
>c:\c++\assignment3\modcounter.h(19) : error C2555: 'ModCounter::++' :
>overriding virtual function differs from 'Counter::++' only by return type
>or calling convention
>        c:\c++\assignment3\counter.h(17) : see declaration of 'Counter'
>Error executing cl.exe.
>
>
>
>Could you please tell me what I am doing wrong?
>
>here is my code.
>
> ...deleted...
>
>//In this method, I want to get the value2 from my derived
>//class, and then access it on the base value variable,
>// is this a right approach?
>virtual ModCounter::operator++()

First, what is the return type of the method here? You need to specify
that as Counter.

>	{
>	  Counter obj=&ModCounter;

You created a Counter object above. You are assigning it the address of
a class (not even an object). This is not valid.

> ...deleted...

If you want to call the base operator++, you can do that by calling

Counter::operator++()

What you need to do is let the base class operator++ manage its
data. The derived should call that and then the derived should manage
its own data.

For example:

class A
{
public:
	virtual A operator++()
	{
		... what ever it does...
	}
};

class B
{
public:
	virtual A operator++()
	{
	// This is B's operator++ method.

		A::operator++(); // I have let A part do its work.

		// Here I will do my part. This may be modifying my
		// variables if any (I am speaking in general here,
		// not specific to Assignment 3). This may also be
		// checking some variable values from A (using its
		// public/protected methods of course) and may be
		// calling more methods on the Base to set/reset/
		// modify some thing.
	}
};

>Thank you for all the help, and God let you be as patient as
>you've been with us.

:)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-405-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 09:01:50 2003
Return-Path: <uhcosc1320-return-405-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72E1n5Z1109653
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 09:01:50 -0500 (CDT)
Received: (qmail 16994 invoked by uid 108); 2 Aug 2003 14:06:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14069 invoked from network); 2 Aug 2003 14:01:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021356.h72DurUP1121295@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 08:56:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment from Counter to ModCounter (fwd)
Status: O
X-UID: 400
Content-Length: 775
X-Keywords: $NotJunk                                                                                           

>One more question:
>Should we support assignment from a Counter to a ModCounter or should we 
>throw an error if this is encountered?  If we do support it, should we throw 
>an error if the Counter's value is above the ModCounter's limit or should we 
>do something weird like take the modulus of the Counter's value?
>
>Thanks,

The spec given in assign3.cpp says the following:

// Assignment of one counter to another must be allowed only if the limits 
// are the same. If limits are not same, throw Invalid exception.

Good question, but I have to let you decide what you should do for this 
given requirement.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-406-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 09:46:46 2003
Return-Path: <uhcosc1320-return-406-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72Ekk5Z1234209
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 09:46:46 -0500 (CDT)
Received: (qmail 8620 invoked by uid 108); 2 Aug 2003 14:51:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6685 invoked from network); 2 Aug 2003 14:48:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021442.h72EguH81080745@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 09:42:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] dynamic casting help (fwd)
Status: O
X-UID: 401
Content-Length: 690
X-Keywords: $NotJunk                                                                                           

>Hello Venkat
>Could you please give a summary of dynamic casting, since Im still trying to figure out where it will be used in the assignment? Would its use be in the ModCounter files?
>Thanks alot

Let's say you have a reference or a pointer to the base type.
If you have to find, at run time, if that is of derived type,
you would use dynamic casting. 

In assignment 3, you will first have to figure out where you
will be given a reference or pointer to base type first.

Then it comes to the question of using dynamic casting.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-407-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 10:58:35 2003
Return-Path: <uhcosc1320-return-407-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72FwZ5Z1425198
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 10:58:35 -0500 (CDT)
Received: (qmail 15391 invoked by uid 108); 2 Aug 2003 16:03:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14259 invoked from network); 2 Aug 2003 16:01:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021556.h72FuSaW1412399@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 10:56:28 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question about Dynamic Casting (fwd)
Status: O
X-UID: 402
Content-Length: 898
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>In this assignment 3, do we really have to use dynamic cast? Because I did my 
eprogram without it and it works just fine. It even gives me the same 
>result... 
>I am really confused whether I need to use dynamic cast in operator== .
>... deleted...
>thanks for your time
>Regards,

There is rumor that your code will be tested with the following test case:

ModCounter mc1(2);
ModCounter mc2(4);

try
{
	cout << "mc1 == mc2: ";
	cout << mc1 == mc2 << endl;
}
catch(...)
{
	cout << "Error" << endl;
}

Counter& c1 = mc1;
Counter& c2 = mc2;
// c1 and c2 are references of type Counter, but refer to ModCounters though.

try
{
	cout << "Again mc1 == mc2: ";
	cout << c1 == c2 << endl;
}
catch(...)
{
	cout << "Error" << endl;
}

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-408-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 12:42:17 2003
Return-Path: <uhcosc1320-return-408-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72HgG5Z1156818
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 12:42:17 -0500 (CDT)
Received: (qmail 10881 invoked by uid 108); 2 Aug 2003 17:47:09 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9863 invoked from network); 2 Aug 2003 17:45:29 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021740.h72HeQVD1150366@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 12:40:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] old exam question (fwd)
Status: O
X-UID: 403
Content-Length: 827
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>For the constructor of the following class, to assign the car pointer you put down the following code:
>m_pCar = pCar;
>
>I thought that if you do this you have two pointers pointing to the same object and may have problems later.  Would you use new and allocate memory over here?  I am confused
> 
>Thanks for all the emails

Typically, I want to create a copy in the copy constructor.

However, in the constructor, I want the person to keep the
car that has been given. If that is what you want, then
you can write m_pCar = pCar; At this point, it is deemed that
the person owns the given car. If you do not want that, you
can write code to make a copy.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-409-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 12:43:59 2003
Return-Path: <uhcosc1320-return-409-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72Hhw5Z1519364
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 12:43:59 -0500 (CDT)
Received: (qmail 11955 invoked by uid 108); 2 Aug 2003 17:48:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7381 invoked from network); 2 Aug 2003 17:41:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021736.h72HaAsF1138788@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 12:36:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question on Assig# operator== (fwd)
Status: O
X-UID: 404
Content-Length: 980
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I am having trouble with my operator= and operator==. 
>I am trying to use dynamic_cast on the argument passed
>to either of these functions so I can access the limit
>variable.  Because the type of the argument is a Base
>reference.  Here is some of my code.  Can you please
>let me know what I am doing wrong.
>
>...deleted...
>
>//The line above will compile and run but gives me a
>unhandled exception. It also give me a warning at
>compile time: (warning C4541: 'dynamic_cast' used on
>polymorphic type 'class Counter' with /GR-;
>unpredictable behavior may result)
>... deleted...
>Can you let me know where my error in thinking is? 
>Thanks for all your help.

The problem is you have not turned on the /GR flag. Please read my 
email sent last night that shows you how to turn on the /GR flag
on VC++.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-410-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 12:44:33 2003
Return-Path: <uhcosc1320-return-410-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72HiX5Z1153908
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 12:44:33 -0500 (CDT)
Received: (qmail 12538 invoked by uid 108); 2 Aug 2003 17:49:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10252 invoked from network); 2 Aug 2003 17:46:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021741.h72Hf6Uu1150480@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 12:41:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Problem Decrementing past 0 (fwd)
Status: O
X-UID: 405
Content-Length: 526
X-Keywords: $NotJunk                                                                                           

>This student stated that "My problem with my decrementing is that I don't see how to change the integer in the variable value with out setting up a loop and incrementing to the limit.  Can you please clarify what you mean by "setting up a loop and incrementing to the limit."  Thank you.
>

Start writing your code and you will see that there is not other way to
do.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-411-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 12:44:59 2003
Return-Path: <uhcosc1320-return-411-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72Hiw5Z1147697
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 12:44:59 -0500 (CDT)
Received: (qmail 12992 invoked by uid 108); 2 Aug 2003 17:49:53 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8838 invoked from network); 2 Aug 2003 17:43:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021738.h72Hccuk1137820@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 12:38:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign3: Testing the value vs limit (fwd)
Status: O
X-UID: 406
Content-Length: 885
X-Keywords: $NotJunk                                                                                           

>Venkat,
>  I created my ModCounter operator++ as follows:
>in my ModCounter.h file under public, I have: 
>...deleted...
>In my .cpp file I have: 
>...deleted...
>This implementation doesn't give me any errors, but the problem is that when I run the code, after it starts to increment the ModCounter, it never goes to the above codes.  It goes straight to the Counter::operator() code.  It never enters my code.  I looked at my code and compared with the textbook and I don't know why it skips my code.  Do you see something wrong with this code.  Thanks a lot.

There are a couple of problems in your code.

1. You can forgetting the () after the getCounterValue. 
2. If you want to compare, you need to use == instead of =.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-412-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 12:49:43 2003
Return-Path: <uhcosc1320-return-412-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72Hng5Z1177154
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 12:49:42 -0500 (CDT)
Received: (qmail 15967 invoked by uid 108); 2 Aug 2003 17:54:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5591 invoked from network); 2 Aug 2003 17:38:08 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021733.h72HX3RG1132010@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 12:33:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 2-dynamic casting (fwd)
Status: O
X-UID: 407
Content-Length: 504
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I did my program and it is working perfectly, but I did not use dynamic 
>casting in it at all.  I've read a lot of e mails from people and they all seem to 
>be using it.  Do you want me to re-write my program so that I am using 
>dynamic-casting??
>Thank you.

Please refer to the response to the previous email sent this 
morning.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-413-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 13:06:21 2003
Return-Path: <uhcosc1320-return-413-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72I6L5Z1215943
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 13:06:21 -0500 (CDT)
Received: (qmail 25920 invoked by uid 108); 2 Aug 2003 18:11:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10812 invoked from network); 2 Aug 2003 17:47:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021741.h72Hfx1x1155767@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 12:41:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] keyword dynamic_cast in Bayou (fwd)
Status: O
X-UID: 408
Content-Length: 519
X-Keywords: $NotJunk                                                                                           

>Venkat, 
>
>I have matched the correct output and I do not see why I would need to
>dynamic cast something. The only reason I would use dynamic cast is to
>differentiate one object from another. However, there is only one
>derived class ... so there's only "one" possibility.
>
>Thanks;

This has been addressed in an email this morning. Please refer to that.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-414-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 13:11:42 2003
Return-Path: <uhcosc1320-return-414-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72IBf5Z1225103
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 13:11:41 -0500 (CDT)
Received: (qmail 29272 invoked by uid 108); 2 Aug 2003 18:16:39 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27761 invoked from network); 2 Aug 2003 18:14:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021809.h72I96Zu1218586@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 13:09:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Another way to enable dynamic casting (fwd)
Status: O
X-UID: 409
Content-Length: 491
X-Keywords: $NotJunk                                                                                           

>Hello Venkat, 
>Another way to enable RTTI without the flags is 
>
>Project-->Settings--> C\C++ tab. In that there is a drop down menu and in 
>there select C++ language. In there is an option for enabling RTTI, just 
>check that and your good to go.

Thanks for sharing this. I am sure some of the students will
benefit from this.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-415-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 13:14:23 2003
Return-Path: <uhcosc1320-return-415-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72IEM5Z1212506
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 13:14:22 -0500 (CDT)
Received: (qmail 31009 invoked by uid 108); 2 Aug 2003 18:19:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27218 invoked from network); 2 Aug 2003 18:13:11 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021808.h72I88bJ1222891@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 13:08:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] another sample test for assign3 (fwd)
Status: O
X-UID: 410
Content-Length: 486
X-Keywords: $NotJunk                                                                                           

>Venkat
>    I was wondering if it was possible for you to put up another sample test for us to run our assign3 on.  I was hoping by doing this, I would be able to make sure that my code was written as general as possible, and not for a specific set of codes.  Thanks.  

I will surely do this on Tuesday and send it to you. ;)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-416-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 13:58:19 2003
Return-Path: <uhcosc1320-return-416-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72IwJ5Z1370519
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 13:58:19 -0500 (CDT)
Received: (qmail 23376 invoked by uid 108); 2 Aug 2003 19:03:16 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22520 invoked from network); 2 Aug 2003 19:01:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021856.h72Iur7T1348092@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 13:56:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] dynamic cast - error c2682 (fwd)
Status: O
X-UID: 411
Content-Length: 775
X-Keywords: $NotJunk                                                                                           

>Venkat,
>When I use dynamic cast, I receive the following error:
>
>error C2682: cannot use dynamic_cast to convert from 'const class ModCounter 
>*'  to 'class ModCounter *'   .  I can't get rid of the const because I need 
>it in my copy constructor parameter.  Any ideas?
>Thank you.

If I have Base& b,

I have the following options

Derived* p = dynamic_cast<Derived*> (&b)

or 

Derived& d = dynnamic_cast<Derived&> (b);

However, if I have a const Base& b, then I should write

const Derived* p = dynamic_cast<const Derived*> (&b)

or 

const Derived& d = dynnamic_cast<const Derived&> (b);

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-417-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 14:11:20 2003
Return-Path: <uhcosc1320-return-417-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72JBK5Z1404508
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 14:11:20 -0500 (CDT)
Received: (qmail 30628 invoked by uid 108); 2 Aug 2003 19:16:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21484 invoked from network); 2 Aug 2003 19:00:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021854.h72IsuYa1335160@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 13:54:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] counter comparisons (fwd)
Status: O
X-UID: 412
Content-Length: 910
X-Keywords: $NotJunk                                                                                           

>Venkat,
>When we compare the counters, we first may be comparing two objects of class ModCounter, or comparing an object of class Counter and an object of class ModCounter, or two objects of class Counter.  Do you think its reasonable to first check which of the above comparison is being made, and then accordingly see what the limit values are of the counter, or the values of the counters.  Do you think that this is a correct way to go?  Or do you think there are other (shorter/smarter) ways? Thanks.
>

Here is what I would do. In my ModCounter, I would thrown an exception
if the limits are not the same between two ModCounters being compared
or if the objects being compared are not the same exact type.
How that gets implemented is upto you.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-418-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 15:01:23 2003
Return-Path: <uhcosc1320-return-418-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72K1M5Z1556888
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 15:01:22 -0500 (CDT)
Received: (qmail 23572 invoked by uid 108); 2 Aug 2003 20:06:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22542 invoked from network); 2 Aug 2003 20:04:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308021959.h72JxIQw1555742@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 14:59:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Sample code sent out earlier (fwd)
Status: O
X-UID: 413
Content-Length: 772
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Earlier today you had sent out an e mail with an example test case.  I added 
>in the test case and wrote an overloaded func for cout <<.  The only way this 
>program works is if in the line where you put cout << c1 == c2 << endl; I 
>rewrite it to read cout << (c1==c2) << endl;.   Is that okay? Also, do you want me 
>to keep my overloaded function for << or do you have your own?
>Thank you.

I stand corrected. You are right. The code should read
cout << (c1 == c2) << endl;

There is no need to overload << for this. It should evaluate the
== and then send the resulting bool to the cout.

Thanks

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-419-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 15:09:08 2003
Return-Path: <uhcosc1320-return-419-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72K975Z1056837
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 15:09:07 -0500 (CDT)
Received: (qmail 27661 invoked by uid 108); 2 Aug 2003 20:14:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25990 invoked from network); 2 Aug 2003 20:10:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308022005.h72K5ZVv1570125@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 15:05:35 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign 3 (fwd)
Status: O
X-UID: 414
Content-Length: 543
X-Keywords: $NotJunk                                                                                           

>I try to create a class called Invalid and I get an error stating that 'class' type redefinition.  Is Invalid like a keyword or something?  Thanks.

Since the class Invalid is already defined in the Counter.h, you
can not create another one with the same name within the same
namespace (and we are not using namespaces here, so basically,
you can't create a class with name Invalid).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-420-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 15:11:46 2003
Return-Path: <uhcosc1320-return-420-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72KBj5Z1408922
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 15:11:45 -0500 (CDT)
Received: (qmail 29287 invoked by uid 108); 2 Aug 2003 20:16:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27247 invoked from network); 2 Aug 2003 20:13:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308022008.h72K8CNo1551207@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 15:08:11 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] previous email (fwd)
Status: O
X-UID: 415
Content-Length: 308
X-Keywords: $NotJunk                                                                                           

>Sorry for the previous email. I realized that you already created a class Invalid after I sent the email.  Sorry for the waste of time.

No problem.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-421-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 15:17:08 2003
Return-Path: <uhcosc1320-return-421-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72KH75Z1074776
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 15:17:07 -0500 (CDT)
Received: (qmail 32280 invoked by uid 108); 2 Aug 2003 20:22:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31497 invoked from network); 2 Aug 2003 20:20:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308022015.h72KFhwv1075971@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 15:15:42 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] HW3 and HW4 posted...
Status: O
X-UID: 416
Content-Length: 295
X-Keywords: $NotJunk                                                                                           

Greetings,

HW3 and HW4 have been posted. These, I hope, will help you further
the understanding of the concept of polymorphism.

Enjoy.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-422-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 16:13:01 2003
Return-Path: <uhcosc1320-return-422-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72LD15Z1243916
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 16:13:01 -0500 (CDT)
Received: (qmail 30913 invoked by uid 108); 2 Aug 2003 21:17:59 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29911 invoked from network); 2 Aug 2003 21:16:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308022110.h72LAxaS1243968@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 16:10:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Dynamic casting error (fwd)
Status: O
X-UID: 417
Content-Length: 466
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>When trying to compile my program with dynamic casting im getting this error 
>
>error C2682: cannot use dynamic_cast to convert from 'const class ModCounter *' to 'class ModCounter *'
>
>how do I fix this one?
>thanks alot

This was answered in an email earlier today. Please refer to it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-423-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 17:25:45 2003
Return-Path: <uhcosc1320-return-423-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72MPi5Z1463570
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 17:25:45 -0500 (CDT)
Received: (qmail 5764 invoked by uid 108); 2 Aug 2003 22:30:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4733 invoked from network); 2 Aug 2003 22:28:40 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308022223.h72MNapO1466332@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 17:23:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Dynamic casting error (fwd)
Status: O
X-UID: 418
Content-Length: 1663
X-Keywords: $NotJunk                                                                                           

>To clarify on your earlier example, there are two counters, a(2) and
>b(4), referring to two ModCounters, c and d.
>
>As it is, c == d is error\false where a == b is true since all it checks
>is the value, not the limit.

Well, if c and d are references, they are mod counters as well isn't it.
So, think about it.

>Now, the "hard" part is determining if the counter is actually a
>Modcounter. This is saying that we are trying to see if the animal is
>really a dog.
>
>However, on the declaration of the dynamic cast,
>
>...deleted...
>
>is this correct? Does the compiler see a == b as a modcounter ==
>counter? I am sort of confused as what is being compared. From that, I
>am also confused on what function to check. In my mind, it would be
>obvious to do the typecheck in the actual counter == function. But that
>is not possible.
>
>Thanks;

What you are missing is the concept of polymorphism. Think about the following:

Dog doggie;

doggie.makeSound(); // This will call Dog's makeSound.

Animal& a = doggie;

a.makeSound(); // Which makeSound will this be. Dog's or Animal's.
		// According to polymorphism, this will be Dog's isn't it.


Now, consider 

Dog doggie;

doggie.play(anotherAnimal); // This will be Dog's play

Animal& a = doggie;
a.play(anotherAnimal); // This will be Dog's play as well.
	// What is being sent to the play method is a reference to
	// Another animal. That could be any animal. We do not know
	// but the play is called on the Dog in both the calls above.

Hope this helps.

Venkat
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-424-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 17:38:21 2003
Return-Path: <uhcosc1320-return-424-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72McL5Z1504588
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 17:38:21 -0500 (CDT)
Received: (qmail 12851 invoked by uid 108); 2 Aug 2003 22:43:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32331 invoked from network); 2 Aug 2003 22:20:08 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308022215.h72MF2d21433174@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 17:15:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Regarding Assign3 (fwd)
Status: O
X-UID: 419
Content-Length: 1361
X-Keywords: $NotJunk                                                                                           

>Mr Venkat
>
>       When i run the program i am getting to warnings. can you help in 
>finding out wut i ma doing wrong.
>
>Program Files\Microsoft Visual 
>Studio\MyProjects\Assignment3\ModCounter.cpp(94) : warning C4715: 'ModCounter::operator++' : not all control paths return a 
>value
>C:\Program Files\Microsoft Visual 
>Studio\MyProjects\Assignment3\ModCounter.cpp(123) : warning C4715: 'ModCounter::operator--' : not all control paths 
>return a value
>Linking...
>
>Assignment3.exe - 0 error(s), 2 warning(s)
>
>My program runs but after execution i get these 2 errors
>
>This is my code for these two binary operators.


Make sure that all control paths return. What is mean by that is,
if you take a if statement, the function should return a proper 
result for both the true and false conditions.

Here is some thing to consider. Generally, I recommend that you
do not put more than one return statement in a function.

Setup variables throughout your function and return at the end of it.

For example instead of writing
////
if (condition)
	return someThing;
else
	return someThing_else;
////

write,

////
result = someThing_else;
if (condition)
	result = someThing;

return result;
////

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-425-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 17:39:51 2003
Return-Path: <uhcosc1320-return-425-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72Mdo5Z1472674
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 17:39:50 -0500 (CDT)
Received: (qmail 13752 invoked by uid 108); 2 Aug 2003 22:44:44 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1041 invoked from network); 2 Aug 2003 22:21:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308022216.h72MGre91442114@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 17:16:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] how to put modcounter's values in the Counter ? (fwd)
Status: O
X-UID: 420
Content-Length: 540
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>        I could not work out how to put the mctr2(2), int 2, into the counter's value. If I could not access to the value how to out put the modcounter's value when do the playwithmodcounter? Thanks!

The 2 in mctr2(2), the 2 within parenthesis sets the limit of the
modulo counter and not the value of the Counter. The value of the
counter will be 0 to start with.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-426-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 17:40:18 2003
Return-Path: <uhcosc1320-return-426-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h72MeH5Z1518855
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 17:40:18 -0500 (CDT)
Received: (qmail 14222 invoked by uid 108); 2 Aug 2003 22:45:16 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 440 invoked from network); 2 Aug 2003 22:21:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308022215.h72MFx6X1442314@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 17:15:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Output for test case (fwd)
Status: O
X-UID: 421
Content-Length: 395
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>Thanks for the help on the previous question.
>
>Is this the output for the test case that you sent in the email?
>
>mc1 == mc2: Error
>Again mc1 == mc2: 1
>
>Thanks Alot

I will let you decide what the output should be.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-427-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 21:25:28 2003
Return-Path: <uhcosc1320-return-427-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h732PS5Z1148397
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 21:25:28 -0500 (CDT)
Received: (qmail 1006 invoked by uid 108); 3 Aug 2003 02:30:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31986 invoked from network); 3 Aug 2003 02:27:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030222.h732MFqt1135778@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 21:22:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] using -> ; 2 operator= (fwd)
Status: O
X-UID: 422
Content-Length: 1462
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I finished my program and I tested it using the given main file and also the 
>test code you provided.  Everything checked out fine even with the test code 
>you provided.  

Hey, this is music to my ears.

>To implement the dynamic casting I had to use -> with the 
>pointer to call menthods and variables associated with that object.  Earlier 
>you said you prefer not to use -> becasue it is a bad practice.  I guess I 
>was wondering if there is another way around that?

You could dynamic cast to a reference if you like. I had sent an email
earlier this morning showing how you can dynamic cast to a reference.

Only thing to remember: If you dynamic cast to pointer, check to
see if the pointer is null. If you dynamic cast to a reference, you
need to catch a bad_cast exception and deal with it.

>Secondly, you also said we are to use dynamic binding where ever we think we 
>will be given a pointer or reference to an object.  Therefore, I concluded 
>we need one for the <snip><snip>. However,  I created 
><snip><snip>
>

I looked at the code. You are almost there. Why not make it virtual 
as well?

>I guess my question is to see if I'm on the right track.  <snip>

Except for the virtual comment above, it looks pretty good. 

Way to go.

>Thanks for your time,

Most welcome.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-428-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 21:26:46 2003
Return-Path: <uhcosc1320-return-428-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h732Qk5Z1146679
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 21:26:46 -0500 (CDT)
Received: (qmail 1689 invoked by uid 108); 3 Aug 2003 02:31:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28039 invoked from network); 3 Aug 2003 02:18:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030213.h732DogL1114658@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 21:13:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] throw exception (fwd)
Status: O
X-UID: 423
Content-Length: 442
X-Keywords: $NotJunk                                                                                           

>Hello, Vankat
>
>I am sorry for my previous question about throw an exception. I soon found 
>out that I forgot write the test code inside of the try block.
>Very sorry for wasting your time.
>Thank you very mush.

No problem. I was wondering what it could be. I can sleep well now.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-429-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 21:29:16 2003
Return-Path: <uhcosc1320-return-429-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h732TG5Z1155318
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 21:29:16 -0500 (CDT)
Received: (qmail 3254 invoked by uid 108); 3 Aug 2003 02:34:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27286 invoked from network); 3 Aug 2003 02:17:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030212.h732CRf41540705@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 21:12:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] throw exception (fwd)
Status: O
X-UID: 424
Content-Length: 1098
X-Keywords: $NotJunk                                                                                           

>Hi, Vankat
>When I tried to check the throw Invalid(), the system crashed.  When I check 
>the previous example you gave to us in the class. I saw in the catch, there is 
>an object of exception class: for example class X{};
>thow X(); try{...}; catch(X& obj). But in the main function of the 
>assing3.cpp, it is
>catch(Invalid). So, should I do something about the Invalid class in the 
>ModCounter class? or just i missed something in my code.   Could you please take a 
>look at my code below and give an advise:
>...deleted...
>Thank you very much.

I took a look at the code you have sent and it does not 
seem to indicate any thing that would give you trouble as you 
have described above. Only thing I will say is, in your main,
make sure you are catching the exception at the place where
your method is being called. If that does not help, zip up
your entire code (entire project) and email it to me and I will
take a look at it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-430-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 21:45:09 2003
Return-Path: <uhcosc1320-return-430-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h732j85Z1208190
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 21:45:09 -0500 (CDT)
Received: (qmail 11085 invoked by uid 108); 3 Aug 2003 02:50:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27590 invoked from network); 3 Aug 2003 02:18:05 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030213.h732D0Or1094947@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 21:13:00 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Output for test case (fwd)
Status: O
X-UID: 425
Content-Length: 466
X-Keywords: $NotJunk                                                                                           

><P>It should be Error both times because the first time you are comparing to unequal ModCounters and second time you are comparing the references to to the unequal ModCounters. </P>
><P>mc1 == mc2: Error<BR>Again mc1 == mc2: Error</P>
><P>Am I right?</P>
><P>Thanks <BR></P></DIV>

Sounds reasonable to me.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-431-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 22:03:52 2003
Return-Path: <uhcosc1320-return-431-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h7333o5Z1266305
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 22:03:52 -0500 (CDT)
Received: (qmail 20136 invoked by uid 108); 3 Aug 2003 03:08:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19141 invoked from network); 3 Aug 2003 03:07:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030302.h73321wc1258435@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 22:02:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] dynamic caste error- C2680 (fwd)
Status: O
X-UID: 426
Content-Length: 988
X-Keywords: $NotJunk                                                                                           

>I tried to check the object if it was a Counter object or a ModCounter object the following way:
>
>bool  ModCounter::operator==(const Counter& other){
>	ModCounter* modcntr = dynamic_cast<ModCounter*>(&other);
>	if (modcntr!=0){....ectera...
>
>When I try to run it, I get an error stating: error C2682: cannot use dynamic_cast to convert from 'const class Counter *' to 'class ModCounter *'
>

Once again, this was discussed in the mail sent out today. Please read it.

>I tried placing a const in front of ModCounter* modcntr=... and I also tried without it, and I keep getting the same error. Is there something else I am doing wrong for this error to keep showing up?  Thanks for your help.  

Yes, you are not paying attention to the details that was presented in
the previous email this morning. Please read it carefully.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-432-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 22:07:16 2003
Return-Path: <uhcosc1320-return-432-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h7337E5Z1271324
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 22:07:14 -0500 (CDT)
Received: (qmail 21915 invoked by uid 108); 3 Aug 2003 03:12:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19963 invoked from network); 3 Aug 2003 03:08:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030303.h7333WcL1257003@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 22:03:32 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Sample code sent out earlier (fwd)
Status: O
X-UID: 427
Content-Length: 1141
X-Keywords: $NotJunk                                                                                           

>Hi Venkat.
>       Regarding the previous e-mail sent out earlier, shouldn't 
>                  
>                 cout<< mc1==mc2 <<endl;
>be written as,
> 
>                 cout<<(mc1==mc2)<<endl; as well?
> 
>Or do you want us to overload the << operator for our ModCounter? 
>Thanks.

It's the same issue as discussed below. No need to overload <<.

>>Venkat,
>>
>>Earlier today you had sent out an e mail with an example test case. I added 
>>in the test case and wrote an overloaded func for cout <<. The only way this 
>>program works is if in the line where you put cout << c1 == c2 << endl; I 
>>rewrite it to read cout << (c1==c2) << endl;. Is that okay? Also, do you want me 
>>to keep my overloaded function for << or do you have your own?
>>Thank you.
>
>I stand corrected. You are right. The code should read
>cout << (c1 == c2) << endl;
>
>There is no need to overload << for this. It should evaluate the
>== and then send the resulting bool to the cout.
>
>Thanks
>
>Venkat Subramaniam
>-- 
>cosc155g@bayou.uh.edu Department of Computer Science
>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-433-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 22:07:18 2003
Return-Path: <uhcosc1320-return-433-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h7337H5Z1273738
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 22:07:17 -0500 (CDT)
Received: (qmail 22073 invoked by uid 108); 3 Aug 2003 03:12:17 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16657 invoked from network); 3 Aug 2003 03:01:49 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030256.h732uhLA1484744@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 21:56:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Test case question (fwd)
Status: O
X-UID: 428
Content-Length: 675
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>After some debugging I found that the second time that you compare using "==" the == of Counter.h is called upon the one that is provided to us. Since dynamic_cast is not implemented there it has no access to ModCounters value, the values are 0, 0(by the constructors), and hence the true value.
>
>Am I right?

Partly. Your observation of which method is being called in your code 
is right.  However, at this point you need to say "haha, that is not
what it should be calling, and I need to ...."

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-434-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 22:11:15 2003
Return-Path: <uhcosc1320-return-434-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h733BE5Z1286227
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 22:11:15 -0500 (CDT)
Received: (qmail 24207 invoked by uid 108); 3 Aug 2003 03:16:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20906 invoked from network); 3 Aug 2003 03:10:13 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030305.h73358SV1268507@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 22:05:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Project properties settings (fwd)
Status: O
X-UID: 429
Content-Length: 441
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I am confused, in the C++ settings, is it /GX or /GR? I remember you
>saying /GR in class, but this email suggests differently. I am also
>using VS 6.0
>
>Thanks,

Very simple. Compile your code without adding any option.
The compiler clearly warns you what you need. :)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-435-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  2 22:23:55 2003
Return-Path: <uhcosc1320-return-435-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h733Nt5Z1313698
	for <cosc155g@bayou.uh.edu>; Sat, 2 Aug 2003 22:23:55 -0500 (CDT)
Received: (qmail 30338 invoked by uid 108); 3 Aug 2003 03:28:54 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18131 invoked from network); 3 Aug 2003 03:04:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030259.h732xmWv1238096@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 2 Aug 2003 21:59:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator++ (fwd)
Status: O
X-UID: 430
Content-Length: 1008
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>I'm still having difficulty with the ModCounter::operator++().  I've tried 
>implementing it many ways but so far, I'm still confused.  Here is my code as 
>follows:
>
>Counter ModCounter::operator++()
>{
>    Counter temp = *this;

Why are you doing the above in the pre-increment?

... rest of the code deleted...
>}
>
>I thought that by making a temp Counter and adding to that and returning it, 
>it would fix it but I keep getting zeros.  Can you offer any advice?

One advice is to take a piece of paper and put a box and part the box
into two parts. On the top part put the value of the counter as 0.
In the second part put the limit of Mod Counter as 2. Now, using a pencil 
and the paper, try to understand what logic should be implemented for ++. Once
you understand the logic and make sure it is correct, you can code it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-436-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 00:37:32 2003
Return-Path: <uhcosc1320-return-436-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h735bW5Z1156131
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 00:37:32 -0500 (CDT)
Received: (qmail 26254 invoked by uid 108); 3 Aug 2003 05:42:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24887 invoked from network); 3 Aug 2003 05:39:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030534.h735YKKQ1158432@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 00:34:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] cryptic error (fwd)
Status: O
X-UID: 431
Content-Length: 632
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Could you please hint as to the possible implications of the following error message:
>
>assignment3\modcounter.h(42) : error C2555: 'ModCounter::++' : overriding virtual function differs from 'Counter::++' only by return type or calling convention

This was discussed in one of the first emails on the subject of assignment 3.

The derived class overriding method should return the same type as
the base method. Please read the relevant email for more details.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-437-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 00:41:33 2003
Return-Path: <uhcosc1320-return-437-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h735fX5Z1179085
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 00:41:33 -0500 (CDT)
Received: (qmail 28037 invoked by uid 108); 3 Aug 2003 05:46:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24210 invoked from network); 3 Aug 2003 05:38:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030532.h735Wu7f1140861@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 00:32:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Use -> or . to get the member? (fwd)
Status: O
X-UID: 432
Content-Length: 742
X-Keywords: $NotJunk                                                                                           

>In the previous email you said that using something as=20
>    p->getvalue()=20
>was bad practice. But if I did not use that, I have to write  as
>    (*p).getvalue()

Using (*p). is no better than using p->. My advice was to use
reference instead of pointer. Again, it does not mean you 
have to.

>It is longer to write and I still cannot see the advantage of that. =
>Could you please verify that for me?

Again, I was not asking you to dereference a pointer using *.
I suggested using a reference instead. That is not important
for you to get done with this assignment, however.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-438-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 00:44:44 2003
Return-Path: <uhcosc1320-return-438-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h735ii5Z1185275
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 00:44:44 -0500 (CDT)
Received: (qmail 29612 invoked by uid 108); 3 Aug 2003 05:49:34 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28662 invoked from network); 3 Aug 2003 05:47:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030542.h735gTDv1171747@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 00:42:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] nevermind (fwd)
Status: O
X-UID: 433
Content-Length: 1864
X-Keywords: $NotJunk                                                                                           

>Please ignore my last email, you've already responded to it.  I apologize for wasting your mailbox space.  But while I'm here, I'd like to express my appreciation for your astonishing patience and persistance.  Thank you for taking the time and investing the effort to help myself and others along the path to programming enlightnement ( a road very rough indeed, at times).  Your class has really motivated me to continue the path and explore other avenues of the computer science and especially, Object-Oriented programming domains.  I am studying electrical engineering, so I don't have much exposure to the COSC neck of campus.  If I wanted to continue further in these topics and others, what classes/books/etc. should I look into next? Also I hear you make many corollaries in class to Java and .NET, neither of which I have any experience in(this is my first go at OO). Which language would be more prudent to investigate first, if you had to make such a call.  Thanks again!
>

The next most important course to take would be Data Structures.
Data Structures is probably the most important area of expertise
that a software develper needs. 

Java has been around for a while and is quite popular. .NET languages
are gaining a lot of popularity. The jury is still out as to which
would be used mostly in the next 3 to 5 years. 

If you know strong OO (which is what I aim for in this course), it
does not matter. It took me just a couple of days to pick up these
knowing C++ and OO fairly well.

I am glad you are enjoying the concepts and are motivated in learning 
further. This is the only aim I have in teaching this course and 
I am glad it is being realized. Wish you all the best.

Regards,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-439-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 00:46:00 2003
Return-Path: <uhcosc1320-return-439-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h735k05Z1176868
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 00:46:00 -0500 (CDT)
Received: (qmail 30331 invoked by uid 108); 3 Aug 2003 05:51:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23325 invoked from network); 3 Aug 2003 05:36:08 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030531.h735V3Wx1126650@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 00:31:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] test case output- figured it out (fwd)
Status: O
X-UID: 434
Content-Length: 530
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>Thanks for your hint. I looked into my book again for a refresher on dynamic_casting and figured out my mistake, and a slight modification to the functions(wherever needed) fixed it all.
>
>In my ... deleted...
>
>Thanks alot for your help....now I can sleep peacefully lol

Good job.
I hope this gives hope for the others still trying to figure it out.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-440-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 00:46:13 2003
Return-Path: <uhcosc1320-return-440-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h735kC5Z1180591
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 00:46:13 -0500 (CDT)
Received: (qmail 30580 invoked by uid 108); 3 Aug 2003 05:51:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25347 invoked from network); 3 Aug 2003 05:40:24 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308030535.h735ZJ4N1161598@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 00:35:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Weird Link Error? (fwd)
Status: O
X-UID: 435
Content-Length: 449
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>   
>i keep getting the following error what could be wrong:
> 
> 
> LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
>Debug/ModCounter.exe : fatal error LNK1120: 1 unresolved externals
>Error executing link.exe.

By mistake you have started out creating a windows application instead
of a console application. Start by creating a new project and make sure
you select Console application this time.

Venkat

From uhcosc1320-return-441-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 07:01:29 2003
Return-Path: <uhcosc1320-return-441-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h73C1R5Z1111611
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 07:01:28 -0500 (CDT)
Received: (qmail 7130 invoked by uid 108); 3 Aug 2003 12:06:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6621 invoked from network); 3 Aug 2003 12:05:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308031200.h73C0C7t1094142@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 07:00:12 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] desperate help with operator= (fwd)
Status: O
X-UID: 436
Content-Length: 2397
X-Keywords: $NotJunk                                                                                           

><DIV>Hi Venkat, </DIV>
><DIV>I was wondering when we say Counter&amp; c1=mc1; where mc1 is a ModCounter, what is being called to set the reference of Counter = ModCounter. </DIV>
><DIV>&nbsp;</DIV>

Nothing is being called on this one. It is just creating a reference
(an alias) to ModCounter. The reference (alias) type is Counter. 
No menthod is being executed at this point.

><DIV>And should be we able to assign a referece to a ModCounter to a Counter object, this shouldn't happen, but what are your views on that. Should be try to stop it or do you suggest a preemptive measure for this?</DIV>

This is perfectly legal. In the class we passed an object of Dog to
the train method. The train method took an Animal reference. Within
the train, we are treating the Dog as an Animal. This is realized by
receiving an Animal reference for the Dog object.

><DIV>I have been trying to figure out the operator= it compiles fine and the main that you gave runs perfectly without any problem and the test code does too, as you said that if the program runs doesn't really mean that it is correct. I was trying out the statement mc1=mc2 in the main.cpp with in a try block to catch any exception operator= might throw</DIV>
><DIV>&nbsp;</DIV>

mc1 = mc2; is much different from

ModCounter& mc3 = mc2;

Lets, understand a few things.

1. X a;
2. X b = a;
3. b = a;
4. X& c = a;

1. Construction of a. Constructor of X called.
2. Copy construction of b. Copy constructor of X called.
3. Assignment of b. operator= of X called.
4. Simply a reference c is created. No methods are called.

>...deleted...
><DIV>Pleaaaaaaaaaaaseeeeeeee help me it is 4 in the morning and I have been stuck on it for past two and a half hours. Even my eyes are hurting. </DIV>

May be this is the problem. Take a break and look at it again and you will
figure it out in no time.

><DIV>And also do we have to have an operator= for ModCounter because ...

Remember, if you do not write one, one is written for you.

>...deleted...
><DIV>I desperately need your help :( </DIV>
><DIV>Thanks Venkat</DIV>

Let me know how it goes after the break.

If you can't figure out the problem in an hour, email me the code and
I will take a look at it and give you some hints.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-442-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 09:40:14 2003
Return-Path: <uhcosc1320-return-442-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h73EeC5Z1253329
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 09:40:13 -0500 (CDT)
Received: (qmail 10259 invoked by uid 108); 3 Aug 2003 14:45:09 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8673 invoked from network); 3 Aug 2003 14:41:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308031436.h73EaW7R1248227@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 09:36:32 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] using -> ; 2 operator= (fwd)
Status: O
X-UID: 437
Content-Length: 957
X-Keywords: $NotJunk                                                                                           

>Venkat,
>I'm confused, why do you want me to make the other one virtual also, since 
>that function doesn't even exist in the Counter class.  Here is my code 
>again for you to look at.
>
>...deleted...
>The bottom one does exist in the base class and is declared virtual as well 
>over there, that's why I have it virtual in ModCounter class.   But the top 
>one doesn't even exist in the Counter class.
>
>Thanks again,

To answer this question, ask why the funtion is virtual in the base class?
Since it is virtual in the base class (Counter), you were able to
override it in the derived. If a function is virtual in your class,
it will be possible to override it in its Derived class (that is
if some one were to write a class ModCounterWhichBeeps that inherits
from ModCounter, for example). 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-443-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 11:30:24 2003
Return-Path: <uhcosc1320-return-443-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h73GUL5Z1362168
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 11:30:22 -0500 (CDT)
Received: (qmail 431 invoked by uid 108); 3 Aug 2003 16:35:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32294 invoked from network); 3 Aug 2003 16:34:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308031629.h73GTC4q1359238@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 11:29:12 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assign 3 Output Question (fwd)
Status: O
X-UID: 438
Content-Length: 1375
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>As I being to implement the different operators, I began to look at the
>output that was provided to us.
> 
>In the first creation of ModCounter in the main file, the limit is set
>to 2. But the way playWithCounter works, we will increment until we get
>to it's limit and NOT surpass it, so shouldn't the ouput reach 2 and
>then go to 0? I noticed the same thing in the second ModCounter which
>it's limit is 3, we reach 2 and then roll back to 0, instead of reaching
>3.

Since the value starts at 0, it reaches a max of limit - 1 and rolls
over. For a mod 2 counter, the permissible values are 0 and 1. For
a mod 3 counter, those are 0, 1 and 2. The value will always be less
than the limit. That is how it is defined in assign3.cpp.

>So can we say that the way the operator ++ works: when limit is reached,
>it rolls back to 0. Therefore the value will not equal limit at all.

Yes.

>I think this is just me, because I have not came upon any emails
>regarding this inquiry. Can you please clarify where my interpretation
>of the requirements are wrong?
> 
>Thanks for all your help!!
>
>Regards,

If you look at the spec given in top of assign3.cpp, you will
see the range of values being specified.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-444-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 12:12:12 2003
Return-Path: <uhcosc1320-return-444-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h73HC85Z1397501
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 12:12:08 -0500 (CDT)
Received: (qmail 21857 invoked by uid 108); 3 Aug 2003 17:17:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20899 invoked from network); 3 Aug 2003 17:15:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308031709.h73H9xki1390571@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 12:09:58 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] dynamic casting (fwd)
Status: O
X-UID: 439
Content-Length: 1610
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
> 
>Reading through the emails, I am still not sure if I am understanding
>polymorphism correctly. If
> 
>ModCounter a(2), b(4)
>Counter &c = a;
>Counter &d = b;
> 
>If a == b, this is false and works correctly because both objects are
>modcounters
> 
>But when c == d; when I trace the program, it enters into the Counter's
>== . so since it was virtual, I overload that function into my
>ModCounter and surprisingly, when c == d is called, it recognized ( I am
>guessing ) that c was of type ModCounter and used the appropriate
>function. 
> 
>The last hurdle is to determine whether d is ModCounter or not. It is up
>to me, and not to runtime to figure that out. Is this where we use
>dynamic casting to determine? Because the line
> 
>const ModCounter* aModCounter = dynamic_cast <const ModCounter*>
>(&other);
> 
>gives some sort of error and leaves the function entirely, as if an
>exception was thrown. So I am sort of confused.
> 
>sorry for the trouble.
 
Your understanding is correct. From what you have described, what you are 
doing is also correct. One reason why dynamic cast may be failing is 
you may have not turned on the switch to make dynamic casting work.
I am assuming you are using VC++. Do a build, rebuild all and note
any warnings you get. I consider warnings as errors and pay
close attention to warning. It should tell you if the flag needs to
be turned on for dynamic casting, if you have not done so already.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-445-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 12:15:35 2003
Return-Path: <uhcosc1320-return-445-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h73HFW5Z1381980
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 12:15:32 -0500 (CDT)
Received: (qmail 23780 invoked by uid 108); 3 Aug 2003 17:20:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22502 invoked from network); 3 Aug 2003 17:18:06 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308031712.h73HCuw01388220@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 12:12:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Treat warnings as Error ******* - Important
Status: O
X-UID: 440
Content-Length: 416
X-Keywords: $NotJunk                                                                                           

While you work on your assignment 3 and 4, make sure you
treat warnings as error. In other words, when I compile your
code, I do not want to see any warning messages. If I
receive warning messages, I will consider this as an error
and you will loose points.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-446-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 19:29:23 2003
Return-Path: <uhcosc1320-return-446-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h740TL5Z1159655
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 19:29:23 -0500 (CDT)
Received: (qmail 10938 invoked by uid 108); 4 Aug 2003 00:34:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9494 invoked from network); 4 Aug 2003 00:32:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040026.h740QpeT1143938@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 19:26:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Dynamic binding (fwd)
Status: O
X-UID: 441
Content-Length: 1322
X-Keywords: $NotJunk                                                                                           

>Venkat, I have a problem understanding dynamic bindings. Could you =
>please give another example of one?
>Thank you

Here is a simple one.

#include <iostream>
using namespace std;

class A
{
public:
	virtual void foo()
	{
		cout << "A::foo" << endl;
	}
};

class B : public A
{
public:
	virtual void foo()
	{
		cout << "B::foo" << endl;
	}
};

class C : public A
{
public:
	virtual void foo()
	{
		cout << "C::foo" << endl;
	}
};

void f1(A& obj)
{
	obj.foo(); 
}

void main()
{
	B objB;
	C objC;

	f1(objB);
	f1(objC);
}

Run the above code and see what the output is.
Then read the rest of this email.

Within f1, you have a reference to A. However, the real object 
may be of type A, B, C or any thing that is derived from B.
The compiler can not (should not) bind to the function foo 
of class A at this call. It should defer it to run time since
the actual foo to be called does not depend on the type of  
the reference (A), but the type of the object (A, B, C, etc,)
at run time. This is basically dynamic binding. Polymorphism
works because the compiler uses dynamic binding.

Hope this helps. Please discuss further if we need to talk about this
more.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-447-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 19:33:07 2003
Return-Path: <uhcosc1320-return-447-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h740X75Z1167691
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 19:33:07 -0500 (CDT)
Received: (qmail 13194 invoked by uid 108); 4 Aug 2003 00:38:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5133 invoked from network); 4 Aug 2003 00:23:45 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040018.h740IZKj1123548@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 19:18:35 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] dynamic cast - error c2682 (fwd)
Status: O
X-UID: 442
Content-Length: 604
X-Keywords: $NotJunk                                                                                           

>I am using dynamic_cast in my operator== and can you make sure I'm right as far as not having a const at the end of the interface.  Is it because we are not getting the state of the object?  And so, there shouldn't be a const at the end, however, there should be "const Counter& other" in our implementation to avoid overhead call to the copy constructor and destructor.  Am I correct?  THanks.

Take a look at Counter.h and make your decision.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-448-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 19:44:15 2003
Return-Path: <uhcosc1320-return-448-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h740iE5Z1203799
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 19:44:15 -0500 (CDT)
Received: (qmail 19483 invoked by uid 108); 4 Aug 2003 00:49:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6580 invoked from network); 4 Aug 2003 00:26:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040021.h740LGWh1131027@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 19:21:16 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Overriding destructors (fwd)
Status: O
X-UID: 443
Content-Length: 1008
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>     In the Counter.h file, you declared the destructor of Counter to be virtual. I tried to override the destructor in the derived class but it gave me errors. Why is that?
>Thanks for your patience and understanding.

You do not actually override the destructor the same way you
override methods. 

If we have a class A

class A
{
public:
	virtual ~A();	
};

In the derived you write

class B : public A
{
public:
	virtual ~B();
};

This is how you override the destructor!

Further, do not call the base class destructor from the derived class
destructor. C++ automatically calls the base class destructor after
the execution of the derived class destructor. We will talk more about
this and problems associated with it in class tomorrow. For assignment 3,
it is no big deal. Simply write a destructor for ModCounter if you 
need it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-449-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 21:52:50 2003
Return-Path: <uhcosc1320-return-449-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h742qn5Z1548896
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 21:52:49 -0500 (CDT)
Received: (qmail 25737 invoked by uid 108); 4 Aug 2003 02:57:53 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14043 invoked from network); 4 Aug 2003 02:35:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040230.h742UGRR1524085@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 21:30:16 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Regarding turning ove assignment (fwd)
Status: O
X-UID: 444
Content-Length: 323
X-Keywords: $NotJunk                                                                                           

>Mr . Venkat
>
>       Do we turn in the assignment the same way as usual but in  a file name 
>assign3.zip
>
>Thanks 

Yes, please follow the same steps as before.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-450-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 21:54:44 2003
Return-Path: <uhcosc1320-return-450-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h742sh5Z1071317
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 21:54:43 -0500 (CDT)
Received: (qmail 26829 invoked by uid 108); 4 Aug 2003 02:59:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18108 invoked from network); 4 Aug 2003 02:43:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040237.h742bxu81541126@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 21:37:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] inheritance and overloading (fwd)
Status: O
X-UID: 445
Content-Length: 1004
X-Keywords: $NotJunk                                                                                           

>Say Derived is a derived class of Base, if I have an overloaded method 
>declared in my Derived class as follows:
>
>void f1(Derived&);
>void f1(Base&);
>
>and I were to write the following user code:
>
>Derived d1;
>f1(d1);

You probably meant to call f1 on another object of Derived.

>
>Can I be confident that it will ALWAYS call the f1 that takes Derived& even 
>though d1 is a "Derived" and a "Base" (as if it were a Dog AND an Animal)?  
>Are there any instances where it would call f1(Base&) on an object declared 
>as a Derived (without casting)?  Does the order of declaration or 
>implementation of these methods matter?
>
>Thanks,

Derived d0;
Derived d1;
d0.f1(d1); // Will call f1(Derived&).

Base& b = d1; // b is a reference to d1
d0.f1(b); // Will call f1(Base&), even though the object that b refers to
	// is of Derived type.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-451-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 21:56:16 2003
Return-Path: <uhcosc1320-return-451-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h742uF5Z1071560
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 21:56:15 -0500 (CDT)
Received: (qmail 27691 invoked by uid 108); 4 Aug 2003 03:01:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24139 invoked from network); 4 Aug 2003 02:54:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040249.h742ngDX1560250@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 21:49:42 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Dynamic Casting and Efficiency (fwd)
Status: O
X-UID: 446
Content-Length: 958
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>In class we discussed how using dynamic casting makes a program slower =
>because of the extra type information that must be kept track of for =
>each object.  In assignment 3, I am using dynamic casting to verify =
>object types in certain functions.  If this was a program that demanded =
>very high efficiency, what other options would we have to implement =
>inheritance that would keep the program robust?
>
>Thanks,

As also mentioned in class, while all was said about dynamic casting,
there are times when it is unavoidable as you would see in 
assignment 3. So, the answer is there is nothing much you can
do in a standard way to solve the problem but to use the dynamic
casting. It should be emphasized that one should use dynamic casting
only if absolutely necessary, however.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-452-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:00:52 2003
Return-Path: <uhcosc1320-return-452-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h7430q5Z1088707
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:00:52 -0500 (CDT)
Received: (qmail 30377 invoked by uid 108); 4 Aug 2003 03:05:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20571 invoked from network); 4 Aug 2003 02:48:06 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040242.h742gtJD1548006@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 21:42:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Forwarded mail...
Status: O
X-UID: 447
Content-Length: 1485
X-Keywords: $NotJunk                                                                                           

>Suppose c1 is a Counter and m1 is a ModCounter, do we need to support 
>operations such as:
>
>c1 = m1;
>c1 == m1;

The above is not under your control and you can't do much about it.
These are called on Counter class which you can't change.

>(Note that these are VERY different from m1 = c1 and m1 == c1.)
>As is, these operations both work fine, they set the value of c1 to the 
>value of m1 and compare the values of c1 and m1 respectively, but I assume 
>that they SHOULD throw exceptions.  The first, I don't think is possible to 
>fix w/o modifying your code, the second I am having trouble with.  If I 
>leave them as is, would it be a good idea to write m1 == c1 so that it will 
>do the same thing as c1 == m1?
>
>Thanks,

m1 == c1 should behave as specified in the problem statement and as
clarified in earlier emails. If I were to have written the Counter class
correctly (I have not written it 100% correctly since I do not want to
expose code you may have to actually write in ModCounter), then
the behavior of m1 == c1 will be the same as c1 == m1. After the 
assignment is turned in, I will show you the correct implementation
of Counter class that I have. At that point, if y ou have written the
ModCounter correctly, then the behavior of the two mentioned above
will be the same.

Good question, by the way.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-453-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:03:26 2003
Return-Path: <uhcosc1320-return-453-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h7433P5Z1494325
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:03:25 -0500 (CDT)
Received: (qmail 32065 invoked by uid 108); 4 Aug 2003 03:08:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28723 invoked from network); 4 Aug 2003 03:02:47 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040257.h742vbTs1082818@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 21:57:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Regarding assignment3 (fwd)
Status: O
X-UID: 448
Content-Length: 603
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>
>       I did my program and i used #include <typeinfo> and i used it like 
>this    if(typeid(other) == typeid(ModCounter)) i don;t if we should use it or 
>not.  But my program runs with it or  even without it so do i use it or not 
>Please what do u think  should do?
>Thanks

:)

You may use what you have given above or dynamic cast. Either should
work. I will talk a bit more about this later on (after assignment 3
is over).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-454-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:13:44 2003
Return-Path: <uhcosc1320-return-454-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743Dh5Z1118501
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:13:43 -0500 (CDT)
Received: (qmail 5558 invoked by uid 108); 4 Aug 2003 03:18:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22787 invoked from network); 4 Aug 2003 02:52:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040247.h742l2451052160@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 21:47:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] about"=" (fwd)
Status: O
X-UID: 449
Content-Length: 1610
X-Keywords: $NotJunk                                                                                           

>Hi, Vankat
>I am not sure if I understand correctly from your one response to someone's 
>email earlier. The question was about:
>
>>ModCounter m1(4);
>>ModCounter m2(4);
>>m1 = ++m2;
>>//Or:
>>m1 = m2++;
>>
>and your answer is:
>Good points. By the way, two things I want to say here. One
>writing ModCounter::operator=(const Counter&) will not solve the
>problem you are talking about here. Having said that, that function 
>may be needed for other purposes. I will leave it at that for you
>to think further about.
>
>>Must my program support operations like the one above?
>>If so, do you have any tips or hints as to how to implement it?
>>
>>Thanks,

It is already specified in the problem statment. What your program
should do on assignment if the limits are not the same.

>You are right on the money. The increment should work fine. But the
>assignment of the result from ++ is the sticky part here.  I don't think
>much can be done about this. 
>
>
>Isn't that you mean here is that the m1 = ++m2; or m1 = m2++; won't work 
>correctly
>in our assignment 3? 
>For my program so far, if I implement the above assignment, they won't get 
>error, but cannot get correct answer, but if I implement ++m2(or m2++), then use 
>m1 = m2; the result is correct. Is there any way to fix it?
>
>Thank you very much.

You need to impement the pre and post increment. Then the assignment 
operator will kick in for the = and should do what is appropriate.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-455-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:14:17 2003
Return-Path: <uhcosc1320-return-455-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743EH5Z1121263
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:14:17 -0500 (CDT)
Received: (qmail 6021 invoked by uid 108); 4 Aug 2003 03:19:16 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1368 invoked from network); 4 Aug 2003 03:11:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040306.h74362fm1111585@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:06:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assign3 : Operator== (fwd)
Status: O
X-UID: 450
Content-Length: 1204
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>My problem is with the Operator== in assign3. Please look for the comments
>in that section.
>
>Here is my ModConter.h file
>...deleted...
>
>	const ModCounter* pModCounter = dynamic_cast<const ModCounter*>
>(&other);
>
>	if (limit == pModCounter->limit) {
>		valueThis = Counter::getCounterValue();

Hold it. Don't you have to check if pModCounter is 0 before
accessing its limit? The whole point of dynamic cast is to
check if the other is of type ModCounter. If you do not check
to see if the pointer is null, you are assuming isn't it.

>		// here is where I am getting an error when I call
>other.getCounterValue()
>		// The error message is: " error C2039: 'other' : is not a
>member of 'Counter'"
>		// So, I don't know how else can I call the getCounterValue
>method to obtain the value
>		// on 'other'... Any suggestions??
>
>		valueOther = Counter::other.getCounterValue();

You can access the getCounterValue exactly how you accessed the limit
in your code example above!

	pModCounter->getCounterValue();

>...deleted...

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-456-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:24:27 2003
Return-Path: <uhcosc1320-return-456-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743OR5Z1166528
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:24:27 -0500 (CDT)
Received: (qmail 12237 invoked by uid 108); 4 Aug 2003 03:29:31 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3934 invoked from network); 4 Aug 2003 03:15:39 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040310.h743ASBM1078676@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:10:28 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] weird errors (fwd)
Status: O
X-UID: 451
Content-Length: 1912
X-Keywords: $NotJunk                                                                                           

>I am having the same problem with my code that I was having with the 
>previous assignment.
>
>gn3.obj : error LNK2001: unresolved external symbol "public: int __thiscall 
>Counter::getCounterValue(void)const " (?getCounterValue@Counter@@QBEHXZ)
>assign3.obj : error LNK2001: unresolved external symbol "public: virtual 
>__thiscall Counter::~Counter(void)" (??1Counter@@UAE@XZ)
>assign3.obj : error LNK2001: unresolved external symbol "public: __thiscall 
>Counter::Counter(void)" (??0Counter@@QAE@XZ)
>assign3.obj : error LNK2001: unresolved external symbol "public: virtual 
>bool __thiscall Counter::operator==(class Counter const &)const " 
>(??8Counter@@UBE_NABV0@@Z)
>assign3.obj : error LNK2001: unresolved external symbol "public: virtual 
>class Counter const & __thiscall Counter::operator=(class Counter const &)" 
>(??4Counter@@UAEABV0@ABV0@@Z)
>assign3.obj : error LNK2001: unresolved external symbol "public: __thiscall 
>Counter::Counter(class Counter const &)" (??0Counter@@QAE@ABV0@@Z)
>Debug/assign3.exe : fatal error LNK1120: 6 unresolved externals
>Error executing link.exe.
>
>assign3.exe - 7 error(s), 0 warning(s)
>
>This is from your code, not mine.  The way that I corrected this error was 
>to have all my code under the .h file and have no .cpp file.  I suspect that 
>this will lead to a loss of points though.  Can you please help?
>Side... I am using the UH visual c++ complier and it has a habit of being 
>bootleg.
>
>Thanks

Simple, when you created your project, you have not added the 
Counter.cpp into the project. Click on Project menu, click on
Add Files menu item and add the Counter.cpp to the project.
When you compile, the Counter.cpp and the ModCounter.cpp
should be compiled in addition to the assign3.cpp. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-457-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:30:29 2003
Return-Path: <uhcosc1320-return-457-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743UT5Z1178152
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:30:29 -0500 (CDT)
Received: (qmail 15727 invoked by uid 108); 4 Aug 2003 03:35:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10103 invoked from network); 4 Aug 2003 03:26:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040321.h743L3Zg1156550@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:21:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] private int value problem (fwd)
Status: O
X-UID: 452
Content-Length: 1493
X-Keywords: $NotJunk                                                                                           

><P>Dr. Venkat,</P>
><P>In the file assignment3.cpp we have ctr.getCounterValue() that is a function of Counter class and not defined as virtual. But in assignment3.cpp, ctr is also used asModCounter. So in case of ModCounter object I am unable to display its value because it is showing the parent's value.</P>

It should. You should not duplicate the value in the ModCounter. 
If you do, you are defeating the purpose of inheritance.
The Counter has the value and the ModCounter should work with it.

><P>Could you please give me a hint how to solve my problem? I am trying to solve it for the past 8 hours.</P>
><P>int value is declared as private member in Counter class. Do I need to use that variable while implementing ModCounter class? or should I just add a new member variable in ModCounter class? I can partially use the member of counter but as it is private, I cannot wrap the variable's value.&nbsp;<BR><BR></P></DIV>

You have to realize that when an object of ModCounter is created,
it has as part of it the Counter as well. So, every ModCounter has
the Counter and its value as well. There is absolutely not reason
for you to write a variable to keep the value in your ModCounter.
Instead, you should use the methods of the Counter to access and
manipulate the Counter's value as allowed by the Counter class methods.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-458-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:31:09 2003
Return-Path: <uhcosc1320-return-458-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743V85Z1186880
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:31:09 -0500 (CDT)
Received: (qmail 16130 invoked by uid 108); 4 Aug 2003 03:36:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12084 invoked from network); 4 Aug 2003 03:29:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040324.h743O6Oj1132764@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:24:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Test case for assignment 3 (fwd)
Status: O
X-UID: 453
Content-Length: 481
X-Keywords: $NotJunk                                                                                           

>Dr.Venkat,
>
>Did you send us a test case for assignment 3?
>
>If so will you resend it?
>
>Thank You,

All emails sent to class can be found at

http://www.cs.uh.edu/~svenkat/summer2003/mailstoclass.

Visit this site and click on Edit menu and Find menu item 
and type "rumor" (without the quotes) and you should see it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-459-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:31:20 2003
Return-Path: <uhcosc1320-return-459-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743VK5Z1169950
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:31:20 -0500 (CDT)
Received: (qmail 16276 invoked by uid 108); 4 Aug 2003 03:36:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6762 invoked from network); 4 Aug 2003 03:20:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040315.h743FHP31124427@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:15:17 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] forgotten e-mails? (fwd)
Status: O
X-UID: 454
Content-Length: 1335
X-Keywords: $NotJunk                                                                                           

>dear venkat-
>
>i was wondering why every e-mail i send you , you
>never respond back to? perhaps you don't receive them.
>i usually go to your web cite and click on "e-mail
>Venkat..etc" and the window pops up and i send
>whatever. however, i never see a response to my
>messages. what's going on?
>

Hi,

When ever I get an email, I send a response to the email to the
mailing list and not directly to the sender of the email.
So, for example, if Jimmy sends me an email, he will receive 
a response from me only if Jimmy is signed up to the mailing list.
So, the question is, are you on the mailing list? If so, check
to make sure that your mailbox is not full.

(I am blind copying you directly in this message so you should get
this email even if you are not on the mailing list).

Other reasons why you may not get my email are:

1. Your mail box is full
2. My emails are being filtered on your side as Spam!
3. You are not on the mailing list.

By the way, please note, I respond to each and every email I receive!!!

If you do not receive a response from me, that means I did not get it
or one of the above mentioned reasons.

Can you let me know if you get this one?

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-460-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:31:26 2003
Return-Path: <uhcosc1320-return-460-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743VQ5Z1185929
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:31:26 -0500 (CDT)
Received: (qmail 16609 invoked by uid 108); 4 Aug 2003 03:36:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2747 invoked from network); 4 Aug 2003 03:13:17 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040308.h74387Oe1110079@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:08:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Help on Operator= (fwd)
Status: O
X-UID: 455
Content-Length: 782
X-Keywords: $NotJunk                                                                                           

>hello Venkat,
>
>Could you please tell me what I am doing wrong?  here is my code for
>overidding operator--(int),
>but my problem is when I want to assign an integer to an object, so I
>can roll back  the value of limit
>once the it reaches zero.
>
>Could you give me some hints?
>Here is my code for that function.
>
>...deleted...
>Thank you for your time and all of your help.

This was discussed in one of the first emails on assignment 3 two
days ago. You can not set the value of the counter to some value.
You will have to loop through and increment the counter as many times
to move the value from 0 to limit - 1.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-461-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:36:41 2003
Return-Path: <uhcosc1320-return-461-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743af5Z1198216
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:36:41 -0500 (CDT)
Received: (qmail 19406 invoked by uid 108); 4 Aug 2003 03:41:45 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8416 invoked from network); 4 Aug 2003 03:23:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040318.h743I97k1144916@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:18:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 3...operator--() (fwd)
Status: O
X-UID: 456
Content-Length: 797
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>In my Counter ModCounter::operator--(int) function am I doing it right by doing the following or am I way off base. It gives me the correct output and it does not break encapsulation:
>
>...deleted...

Looks good to me.

>Also, where I have "note 1", why do I get an error if i called the function "Counter::operator--(int)"?
>

This is not a valid syntax to call the post increment!

There is no good way to do that. It is better to call the pre-increment
instead like you have done.

>stating: "error C2144: syntax error : missing ')' before type 'int'"
>and "error C2059: syntax error : ')'"
>
>Thank you for your time.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-462-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:37:22 2003
Return-Path: <uhcosc1320-return-462-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743bK5Z1205719
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:37:22 -0500 (CDT)
Received: (qmail 19893 invoked by uid 108); 4 Aug 2003 03:42:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15386 invoked from network); 4 Aug 2003 03:34:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040329.h743TRIJ1179517@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:29:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] FW: your mail (fwd)
Status: O
X-UID: 457
Content-Length: 741
X-Keywords: $NotJunk                                                                                           

>Since this went to 2 points but no one got it, are you sure I couldn't get
>at least 1? :)  If not, no biggie.  Couldn't hurt to ask right?  Or as Wayne
>Gretzky put it, "You miss 100 percent of the shots you don't take."

:)

I agree, about Gretzky's statement that is. Sorry, I gave you a second
chance over email by asking for a stronger response.

>I'm guessing you wanted me to say "must be private...".  But really, that's
>the only way to implement the answer I gave.
>See ya Monday.

See you on Monday, and I am sure you will have opportunity to grab 
another bonus point. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-463-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:40:53 2003
Return-Path: <uhcosc1320-return-463-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743er5Z1215857
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:40:53 -0500 (CDT)
Received: (qmail 21833 invoked by uid 108); 4 Aug 2003 03:45:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17366 invoked from network); 4 Aug 2003 03:37:44 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040332.h743WYb01132715@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:32:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problem in Constructor for assign3 (fwd)
Status: O
X-UID: 458
Content-Length: 942
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>I have spent two hours trying to figure out what is wrong with my constructor but cannot figure it out.   When I compile my code it gives me this error:
>
> 
>
>error C2248: 'ModCounter::ModCounter' : cannot access private member declared in class 'ModCounter'
>        c:\assign3b\modcounter.h(9) : see declaration of 'ModCounter::ModCounter'
>Error executing cl.exe.
>
>
>Below is my code could you please take a look at it and give me some hints on what I am doing wrong.  Thank you very much.

Since you did not show the ModCounter.h contents, I have no idea.
My only guess is, make sure the constructor of ModCounter is 
declared in .h under the public: part of the class.

If that does not fix the problem, email me both the complete .h and
.cpp file you have.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-464-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:41:00 2003
Return-Path: <uhcosc1320-return-464-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743ex5Z1214486
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:41:00 -0500 (CDT)
Received: (qmail 21986 invoked by uid 108); 4 Aug 2003 03:45:59 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13103 invoked from network); 4 Aug 2003 03:30:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040325.h743PVjv1159806@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:25:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] warning about dynamic casting (fwd)
Status: O
X-UID: 459
Content-Length: 657
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>When i compile my program i get this warning on every line i've used dynamic 
>casting
>
>warning C4541: 'dynamic_cast' used on polymorphic type 'class ModCounter' 
>with /GR-; unpredictable behavior may result
>
>also my progam carshes in the end after it outputs different
>Can u help me plaese
>Thanks

Yes. This has been discussed more than once in the email.
Please read those emails. Past emails to the class can be
found at 

http://www.cs.uh.edu/~svenkat/summer2003/mailstoclass

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-465-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:45:47 2003
Return-Path: <uhcosc1320-return-465-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743jk5Z1224035
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:45:47 -0500 (CDT)
Received: (qmail 24469 invoked by uid 108); 4 Aug 2003 03:50:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23049 invoked from network); 4 Aug 2003 03:47:47 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040342.h743gZup1185667@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:42:35 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] problem with Derived::operator= not being called (fwd)
Status: O
X-UID: 460
Content-Length: 1081
X-Keywords: $NotJunk                                                                                           

>I have 
> 
>virtual const Counter& operator=(const Counter& other); 
> 
>in my ModCounter class.  I have implemented it, as well, in ModCounter.cpp
>with 
> 
>const Counter& ModCounter::operator=(const Counter& other) {...}
> 
>when I call it however, with:
> 
>ModCounter m(20);
>ModCOunter m1(20);
> 
>m = m1;
> 
>the code in my ModCounter class is not called.  It goes straight to the
>operator= in Counter.  Why in the world would it do that?

Isn't C++ beautiful!

Here is a hint. Did you remember Law-Of-Big three?

And here is a bonus as well. The first person to answer the above
question wins it. And the question is stated here again for your
benefit:

Bonus Question Begin
I have implemented 
const Counter& ModCounter::operator=(const Counter& other).

Now m and m1 are objects of ModCounter.

If I do m = m1, it executes the operator= in Counter class and not
the one mentioned above. Why?
Bonus Question End

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-466-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:47:31 2003
Return-Path: <uhcosc1320-return-466-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743lU5Z1195071
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:47:30 -0500 (CDT)
Received: (qmail 25517 invoked by uid 108); 4 Aug 2003 03:52:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18068 invoked from network); 4 Aug 2003 03:39:08 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040333.h743Xv561195938@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:33:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] using -> ; 2 operator= (fwd)
Status: O
X-UID: 461
Content-Length: 755
X-Keywords: $NotJunk                                                                                           

>Venkat,
>  If we use dynamic cast to a reference, how would we be able to check if it points to the reference.  When we use pointers, we can just check if it's zero or not, but how does it work with references.  Do we see if the reference is equal to the object.  If I have:
>const Base& b, then I should write
>const Derived& d = dynnamic_cast<const Derived&> (b);
>If the above step worked, should I compare the references such as if (d=b)....?  Thanks. 

This was discussed in previous email. Please visit 

http://www.cs.uh.edu/~svenkat/summer2003/mailstoclass

and look for (find) bad_cast.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-467-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:47:37 2003
Return-Path: <uhcosc1320-return-467-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743lb5Z1227775
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:47:37 -0500 (CDT)
Received: (qmail 25721 invoked by uid 108); 4 Aug 2003 03:52:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20321 invoked from network); 4 Aug 2003 03:42:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040337.h743bhno1201696@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:37:43 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] error at dynamic cast (fwd)
Status: O
X-UID: 462
Content-Length: 906
X-Keywords: $NotJunk                                                                                           

>I run my code with the following lines of code:
>bool ModCounter::operator==(const Counter& other) const{
>const ModCounter& modcntr = dynamic_cast<const ModCounter&> (other);
> when it enters this method and after it executes, I get an windows error.  While trying to debug, I come across the first line of code within this method and then I get an error stating:
>"Unhandled exception in assign3.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception"   I compared this line of codes with yours and the in class example, but I don't know where I'm going wrong.  Can you please help.  I appreciate it.  

This is because you have not handled the bad_cast exception
thrown by the dynamic cast. Please refer to my response to your
previous email.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-468-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:52:02 2003
Return-Path: <uhcosc1320-return-468-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743q15Z1236022
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:52:02 -0500 (CDT)
Received: (qmail 27979 invoked by uid 108); 4 Aug 2003 03:57:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19356 invoked from network); 4 Aug 2003 03:41:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040336.h743aV8w1203909@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:36:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign3: operator== (fwd)
Status: O
X-UID: 463
Content-Length: 997
X-Keywords: $NotJunk                                                                                           

>When I use dynamic_cast, I use it first by pointer and then use it by reference, as shown below.
>
>POINTERS: (part of the  actual code)
>...deleted...
>
>REFERENCE: (part of the actual code)
>...deleted...
>where getLimit() is in my ModCounter as :
>int ModCounter::getLimit(){return limit;}
>
>The problem is that when I run the code as a pointer or reference, I get the same code:
>error C2662: 'getLimit' : cannot convert 'this' pointer from 'const class ModCounter' to 'class ModCounter &'
>
>Is there something wrong with my operator== or the call to my getLimit methods.  Thanks.	

Yes, you are forgetting rule number 1 - make your query methods
a const method. Have you made your own getLimit a const method?
In fact, you do not even need the getLimit method to be called here.
You can simply access the limit variable, isn't it?

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-469-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:54:08 2003
Return-Path: <uhcosc1320-return-469-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743s75Z1250384
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:54:07 -0500 (CDT)
Received: (qmail 29234 invoked by uid 108); 4 Aug 2003 03:59:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27342 invoked from network); 4 Aug 2003 03:55:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040350.h743onEA1243651@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:50:49 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Forwarded mail...
Status: O
X-UID: 464
Content-Length: 802
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat 
>
> 
>
>In class, you showed us an example of how you could compare class
>objects to see if they were identical. I can not find that code. Can you
>please tell me where to find the code or could you please email the
>code.
>

Do you mean the following (written typically within operator=)

if (this != &other)

>Secondly should our code be able to do the following.
>
> 
>
>Counter S,R;
>
>ModCounter G,J;
>
> 
>
> 
>
>G==J; //this is a given
>
> 
>
> 
>
>G==S;//throw exception
>
> 
>
>R==G;//the right hand object is your class so am I write that a global
>function would be necessary.
> 

This was addressed in a previous email a few hour ago.
Please visit the URL with previous emails and
search (find) for "written it 100% correctly" (without the quotes).

>
> 
>
>Thanks,
>

Venkat

From uhcosc1320-return-470-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:57:28 2003
Return-Path: <uhcosc1320-return-470-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743vR5Z1267395
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:57:28 -0500 (CDT)
Received: (qmail 31223 invoked by uid 108); 4 Aug 2003 04:02:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25345 invoked from network); 4 Aug 2003 03:52:11 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040347.h743l1sF1225038@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:47:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Static binding operator= (fwd)
Status: O
X-UID: 465
Content-Length: 1846
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>Please look at my test code below. My questions are written after the code. 
>The output I'm getting in VC++ 6.0 is
>
>coming into counter(base)
>foo(derived)
>Press any key to continue
>
>#include <iostream>
>using namespace std;
>
>
>class Counter
>{
>public:
>	virtual const Counter& Counter::operator=(const Counter& other)
>	{
>		cout << "coming into counter(base)" << endl;
>		return *this;
>	}
>};
>
>class ModCounter: public Counter
>{
>public:
>	virtual const Counter& ModCounter::operator =(const Counter& other)
>	{
>		cout << "coming into modcounter(derived)" << endl;
>		return * this;
>	}
>};
>
>
>class base
>{
>public:
>	virtual void foo(base& b)
>	{
>		cout << "foo(base)"<< endl;
>	}
>};
>
>class derived: public base
>{
>public:
>	virtual void foo(base& b)
>	{
>		cout << "foo(derived)"<< endl;
>	}
>};
>
>
>void main()
>{
>	ModCounter mc1, mc2;
>	mc1 = mc2;
>
>	derived d1, d2;
>	d1.foo(d2);
>}
>
>
>In my main program when I do mc1 = mc2, I expected the operator= of the 
>ModCounter class to be called since we are calling operator= on mc1 object. 
>But somehow the operator= of the base class(Counter) is being called. My 
>first question is I expect this to be static binding because I am calling 
>the operator= method on mc1 object. Am I right?

There is a bonus point out there for this. So, let's see who 
grabs this one.

>...deleted...
>But instead of operator=, if I have some method called foo(), the compiler 
>is binding to the foo() method of the derived class as is seen from my 
>output.
>
>Could you please explain to me this difference in binding? Thanks,

I will as soon as I hear from some one who talkes up the posted
challenge.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-471-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 22:57:38 2003
Return-Path: <uhcosc1320-return-471-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h743vc5Z1268563
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 22:57:38 -0500 (CDT)
Received: (qmail 31464 invoked by uid 108); 4 Aug 2003 04:02:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23951 invoked from network); 4 Aug 2003 03:49:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040344.h743iQkB1106969@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 22:44:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] inheritance and overloading (fwd)
Status: O
X-UID: 466
Content-Length: 1924
X-Keywords: $NotJunk                                                                                           

><P>Isn't this hiding.</P>
><P>I was wondering can you and should you over ride static methods. <BR><BR></P></DIV>

Here is not even talking about the methods being in the base class.
There is no issue of hiding in this case.

Venkat

><DIV></DIV>&gt;From: "Dr. Venkat Subramaniam" <COSC155G@BAYOU.UH.EDU>
><DIV></DIV>&gt;To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List) 
><DIV></DIV>&gt;Subject: [uhcosc1320] inheritance and overloading (fwd) 
><DIV></DIV>&gt;Date: Sun, 3 Aug 2003 21:37:59 -0500 (CDT) 
><DIV></DIV>&gt; 
><DIV></DIV>&gt; &gt;Say Derived is a derived class of Base, if I have an overloaded method 
><DIV></DIV>&gt; &gt;declared in my Derived class as follows: 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;void f1(Derived&amp;); 
><DIV></DIV>&gt; &gt;void f1(Base&amp;); 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;and I were to write the following user code: 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;Derived d1; 
><DIV></DIV>&gt; &gt;f1(d1); 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;You probably meant to call f1 on another object of Derived. 
><DIV></DIV>&gt; 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;Can I be confident that it will ALWAYS call the f1 that takes Derived&amp; even 
><DIV></DIV>&gt; &gt;though d1 is a "Derived" and a "Base" (as if it were a Dog AND an Animal)? 
><DIV></DIV>&gt; &gt;Are there any instances where it would call f1(Base&amp;) on an object declared 
><DIV></DIV>&gt; &gt;as a Derived (without casting)? Does the order of declaration or 
><DIV></DIV>&gt; &gt;implementation of these methods matter? 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;Thanks, 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;Derived d0; 
><DIV></DIV>&gt;Derived d1; 
><DIV></DIV>&gt;d0.f1(d1); // Will call f1(Derived&amp;). 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;Base&amp; b = d1; // b is a reference to d1 
><DIV></DIV>&gt;d0.f1(b); // Will call f1(Base&amp;), even though the object that b refers to 

From uhcosc1320-return-472-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 23:07:55 2003
Return-Path: <uhcosc1320-return-472-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h7447s5Z1294611
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 23:07:54 -0500 (CDT)
Received: (qmail 4739 invoked by uid 108); 4 Aug 2003 04:12:59 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3937 invoked from network); 4 Aug 2003 04:11:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040406.h7446OGt1282818@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 23:06:24 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Question on Assig# operator== (fwd)
Status: O
X-UID: 467
Content-Length: 638
X-Keywords: $NotJunk                                                                                           

>Do you know how to turn /GR on in .net 2003? The help file is not
>helping =(
>
>Thanks.

This is for the Visual Studio .NET 2003 (Unmanged C++ project).
Those using Visual Studio 6.0 or UNIX or some thing else, please
ignore this mail.

Open the project's Property Pages dialog box. (You can do this
	by right clicking on project name in the solutions explorer).
Click the C/C++ folder. 
Click the Language property page. 
Modify the Enable Run-Time Type Info property to True.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-473-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 23:14:50 2003
Return-Path: <uhcosc1320-return-473-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h744Eo5Z1318123
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 23:14:50 -0500 (CDT)
Received: (qmail 8197 invoked by uid 108); 4 Aug 2003 04:19:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6349 invoked from network); 4 Aug 2003 04:16:16 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040411.h744B5cg1096001@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 23:11:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Static binding operator= (fwd)
Status: O
X-UID: 468
Content-Length: 731
X-Keywords: $NotJunk                                                                                           

>The command is looking for a ModCounter right hand input, not a counter
>right hand. Since it doesn't exist, it goes into the base.
>
>For it to go into mod, change declaration to
>
>virtual const Counter& ModCounter::operator =(const ModCounter& other)
>
>in order to accept modcounter = modcounter.
>
>The original declaration was modcounter = counter. The current problem I
>am having with typecasting

This is not the correct answer for the bonus question.

I will not forward all the responses I receive. I will forward
only the correct one if and when I receive it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-474-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 23:15:48 2003
Return-Path: <uhcosc1320-return-474-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h744Fl5Z1281638
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 23:15:47 -0500 (CDT)
Received: (qmail 8728 invoked by uid 108); 4 Aug 2003 04:20:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6756 invoked from network); 4 Aug 2003 04:17:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040411.h744BoPn1302896@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 23:11:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Question on Assig# operator== (fwd)
Status: O
X-UID: 469
Content-Length: 1115
X-Keywords: $NotJunk                                                                                           

>Praise the Lord (or divine sentient being(s)) =)

:)

>
>Thanks.
>
>-----Original Message-----
>From: Dr. Venkat Subramaniam [mailto:cosc155g@Bayou.UH.EDU] 
>Sent: Sunday, August 03, 2003 11:06 PM
>To: COSC 1320 Mailing List
>Subject: RE: [uhcosc1320] Question on Assig# operator== (fwd)
>
>>Do you know how to turn /GR on in .net 2003? The help file is not
>>helping =(
>>
>>Thanks.
>
>This is for the Visual Studio .NET 2003 (Unmanged C++ project).
>Those using Visual Studio 6.0 or UNIX or some thing else, please
>ignore this mail.
>
>Open the project's Property Pages dialog box. (You can do this
>	by right clicking on project name in the solutions explorer).
>Click the C/C++ folder. 
>Click the Language property page. 
>Modify the Enable Run-Time Type Info property to True.
>
>Venkat Subramaniam
>--				
>cosc155g@bayou.uh.edu		Department of Computer Science
>http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx
>77204-3475
>
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-475-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 23:17:54 2003
Return-Path: <uhcosc1320-return-475-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h744Hs5Z1190901
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 23:17:54 -0500 (CDT)
Received: (qmail 9980 invoked by uid 108); 4 Aug 2003 04:22:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5133 invoked from network); 4 Aug 2003 04:13:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040408.h7448NkC1274100@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 23:08:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] error at dynamic cast (fwd)
Status: O
X-UID: 470
Content-Length: 1671
X-Keywords: $NotJunk                                                                                           

>But why does it give me the error at line :>const ModCounter& modcntr = dynamic_cast<const ModCounter&> (other);
>  shouldn't it give me an error after it, because then we'll know if modcntr was made a reference/pointer to something?  Thanks
>

Because, unlike a pointer, a reference can never be null or invalid.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/03/03 10:37 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] error at dynamic cast (fwd)
>
>> 
>> >I run my code with the following lines of code:
>>bool ModCounter::operator==(const Counter& other) const{
>>const ModCounter& modcntr = dynamic_cast<const ModCounter&> (other);
>> when it enters this method and after it executes, I get an windows
>error.  While trying to debug, I come across the first line of code within this
>method and then I get an error stating:
>>"Unhandled exception in assign3.exe (KERNEL32.DLL): 0xE06D7363: Microsoft 
>C++ Exception"   I compared this line of codes with yours and the in class 
>example, but I don't know where I'm going wrong.  Can you please help.  I
>appreciate it.  
>
>This is because you have not handled the bad_cast exception
>thrown by the dynamic cast. Please refer to my response to your
>previous email.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-476-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug  3 23:29:30 2003
Return-Path: <uhcosc1320-return-476-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h744TT5Z1358621
	for <cosc155g@bayou.uh.edu>; Sun, 3 Aug 2003 23:29:29 -0500 (CDT)
Received: (qmail 16034 invoked by uid 108); 4 Aug 2003 04:34:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5767 invoked from network); 4 Aug 2003 04:14:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040409.h7449j1G1295714@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 3 Aug 2003 23:09:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] error at dynamic cast (fwd)
Status: O
X-UID: 471
Content-Length: 1667
X-Keywords: $NotJunk                                                                                           

>Are you suggesting that we try to reference modcntr to other or else throw the exception?  I am asking because in the Animal example, for Dog, Cat, and Horse you didn't have anything thrown for an exception.  THanks.
>

If you use pointer you will check for null of the pointer after
the dynamic_cast. I suggest that you do this in assignment 3
and keep it simple. If you insist on dynamic_casting to a 
reference instead of pointer, then you have to deal with the 
exception.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/03/03 10:37 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] error at dynamic cast (fwd)
>
>> 
>> >I run my code with the following lines of code:
>>bool ModCounter::operator==(const Counter& other) const{
>>const ModCounter& modcntr = dynamic_cast<const ModCounter&> (other);
>> when it enters this method and after it executes, I get an windows
>error.  While trying to debug, I come across the first line of code within this
>method and then I get an error stating:
>>"Unhandled exception in assign3.exe (KERNEL32.DLL): 0xE06D7363: Microsoft 
>C++ Exception"   I compared this line of codes with yours and the in class 
>example, but I don't know where I'm going wrong.  Can you please help.  I
>appreciate it.  
>
>This is because you have not handled the bad_cast exception
>thrown by the dynamic cast. Please refer to my response to your
>previous email.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
From uhcosc1320-return-477-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 01:38:29 2003
Return-Path: <uhcosc1320-return-477-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h746cS5Z1218238
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 01:38:29 -0500 (CDT)
Received: (qmail 22930 invoked by uid 108); 4 Aug 2003 06:43:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18965 invoked from network); 4 Aug 2003 06:36:08 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040630.h746UvH61202970@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 01:30:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: FW: [uhcosc1320] problem with Derived::operator= not being called (fwd)
Status: O
X-UID: 472
Content-Length: 1310
X-Keywords: $NotJunk                                                                                           

>Ok.  It seems that an override of an inherited assignment operator doesn't
>suppress the compiler-generated default assignment operator. You have to
>define the default assignment operator to call the virtual one.  In every
>class that inherits the virtual one.  Of course, this means defining it
>non-virtual.  One side effect that you have to define an override of the
>virtual operator=() even when you don't strictly need one; otherwise, the
>"default" one will hide the virtual one.  So to handle polymorphism in
>assignment operators involves declaring both a virtual and a non-virtual
>assignment operator in every class (except the root class of each
>inheritance hierarchy), with the non-virtual calling the virtual and the
>virtual asserting that both objects involved are the same class.  Any time a
>calling function couldn't guarantee the invariant would hold, it would have
>to avoid using the assignment operator and manually delete the object
>referenced by the target variable and new up a new one of the proper type.
>
>From: http://www.concentric.net/~rtgillam/pubs/reassign.doc

You said it and the bonus points are yours to take.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-478-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 01:41:14 2003
Return-Path: <uhcosc1320-return-478-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h746fD5Z1229503
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 01:41:13 -0500 (CDT)
Received: (qmail 24666 invoked by uid 108); 4 Aug 2003 06:46:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22242 invoked from network); 4 Aug 2003 06:42:16 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040637.h746b54O1219558@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 01:37:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] this is more of a generic q (fwd)
Status: O
X-UID: 473
Content-Length: 675
X-Keywords: $NotJunk                                                                                           

>this is more of a generic q when I try to run an example from class =
>msdos screen shows yet nothing seems to run ...and when I close the =
>window it says to troubleshoot it help...oh I might add that it just =
>received  some added memory...and a system tuneup (which was not =
>complete...) could this be the problem..help=20

Are you running the program from within Visual Studio 6.0.
Elaborate more on how you are running the program. You may 
want to talk to me after class tomorrow for further help on this.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-479-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 01:43:43 2003
Return-Path: <uhcosc1320-return-479-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h746hg5Z1235088
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 01:43:42 -0500 (CDT)
Received: (qmail 26132 invoked by uid 108); 4 Aug 2003 06:48:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16854 invoked from network); 4 Aug 2003 06:32:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040627.h746RU261197655@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 01:27:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] error at dynamic cast (fwd)
Status: O
X-UID: 474
Content-Length: 1777
X-Keywords: $NotJunk                                                                                           

>Have we gone over bad_cast? If so, is there an example of one on the website?  Thanks.

No we have not and we will not be going over that in class either.
As I mentioned, for Assignement 3, you do not have to dynamic_cast
to a reference. You may dynamic_cast to a pointer and it will still
do what is needed. You are most welcome to study further on this.
I have given pointers and details about this over the emails.

Venkat

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/03/03 10:37 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] error at dynamic cast (fwd)
>
>> 
>> >I run my code with the following lines of code:
>>bool ModCounter::operator==(const Counter& other) const{
>>const ModCounter& modcntr = dynamic_cast<const ModCounter&> (other);
>> when it enters this method and after it executes, I get an windows
>error.  While trying to debug, I come across the first line of code within this
>method and then I get an error stating:
>>"Unhandled exception in assign3.exe (KERNEL32.DLL): 0xE06D7363: Microsoft 
>C++ Exception"   I compared this line of codes with yours and the in class 
>example, but I don't know where I'm going wrong.  Can you please help.  I
>appreciate it.  
>
>This is because you have not handled the bad_cast exception
>thrown by the dynamic cast. Please refer to my response to your
>previous email.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-480-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 01:51:49 2003
Return-Path: <uhcosc1320-return-480-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h746pm5Z1271356
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 01:51:48 -0500 (CDT)
Received: (qmail 30681 invoked by uid 108); 4 Aug 2003 06:56:53 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19707 invoked from network); 4 Aug 2003 06:37:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040632.h746WZgs1211281@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 01:32:35 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: [uhcosc1320] error at dynamic cast (fwd)
Status: O
X-UID: 475
Content-Length: 2585
X-Keywords: $NotJunk                                                                                           

>Sorry to bother you again, but how come when I change modcntr to a pointer instead of a reference, I still get the error in the same location, instead of after that location?  Thanks again.
>

Did you turn on the flag /GR to make dynamic cast work?
If you did not, you should be getting warnings that you are
not setting that flag.

If you have not set the flag, please refer to earlier emails on the
topic.

Venkat

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/03/03 11:08 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: Re: [uhcosc1320] error at dynamic cast (fwd)
>
>> 
>> >But why does it give me the error at line :>const ModCounter& modcntr =
>dynamic_cast<const ModCounter&> (other);
>>  shouldn't it give me an error after it, because then we'll know if
>modcntr was made a reference/pointer to something?  Thanks
>>
>
>Because, unlike a pointer, a reference can never be null or invalid.
>
>Venkat
>
>>-------Original Message-------
>>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>>Sent: 08/03/03 10:37 PM
>>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>>Subject: [uhcosc1320] error at dynamic cast (fwd)
>>
>>> 
>>> >I run my code with the following lines of code:
>>>bool ModCounter::operator==(const Counter& other) const{
>>>const ModCounter& modcntr = dynamic_cast<const ModCounter&> (other);
>>> when it enters this method and after it executes, I get an windows
>>error.  While trying to debug, I come across the first line of code
>within this
>>method and then I get an error stating:
>>>"Unhandled exception in assign3.exe (KERNEL32.DLL): 0xE06D7363:
>Microsoft 
>>C++ Exception"   I compared this line of codes with yours and the in
>class 
>>example, but I don't know where I'm going wrong.  Can you please help.  I
>>appreciate it.  
>>
>>This is because you have not handled the bad_cast exception
>>thrown by the dynamic cast. Please refer to my response to your
>>previous email.
>>
>>Venkat Subramaniam
>>--      	      	      	      	
>>cosc155g@bayou.uh.edu      	      	Department of Computer Science
>>http://www.cs.uh.edu/~svenkat       	University of Houston, Houston, Tx
>>77204-3475
>>> 
>>
>
>
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-482-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 06:18:46 2003
Return-Path: <uhcosc1320-return-482-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74BIk5Z1503749
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 06:18:46 -0500 (CDT)
Received: (qmail 7644 invoked by uid 108); 4 Aug 2003 11:23:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20209 invoked from network); 4 Aug 2003 06:38:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040633.h746XLim1207684@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 01:33:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Invalid Exception (fwd)
Status: O
X-UID: 476
Content-Length: 621
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>I am having a little trouble in one part of assignment 3. For the part where 
>we will have to throw an Invalid Exception, I am lost and confused on this 
>part.
>
>Would we create a new .h and .cpp for Invalid Exception. And if so, how do 
>we link these together? If not, where do I define the class for Invalid 
>Exception?
>
>Thank you very much for your time! :)

This class is already defined for your use. It is located in
the Counter.h file.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-481-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 01:55:49 2003
Return-Path: <uhcosc1320-return-481-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h746tn5Z1276133
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 01:55:49 -0500 (CDT)
Received: (qmail 769 invoked by uid 108); 4 Aug 2003 07:00:54 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15269 invoked from network); 4 Aug 2003 06:29:49 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308040624.h746ObUm1185404@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 01:24:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Re: Run time error!  - Assignment 3 (fwd)
Status: O
X-UID: 477
Content-Length: 406
X-Keywords: $NotJunk                                                                                           

>Oh, so really we should have to operator =.  One for the derived class and one that we are using as an assignment = method.  Right?  I have the operator=(const BaseOfX&) only.

That's Oh as in Oh, finally I see the light at the end of the tunnel.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-483-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 06:23:58 2003
Return-Path: <uhcosc1320-return-483-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74BNv5Z1518139
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 06:23:57 -0500 (CDT)
Received: (qmail 10690 invoked by uid 108); 4 Aug 2003 11:29:03 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9243 invoked from network); 4 Aug 2003 11:26:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041121.h74BL7I91522061@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 06:21:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] bonus question operator= (fwd)
Status: O
X-UID: 478
Content-Length: 982
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>Since you haven't replied to my earlier mails, I guess I did not get the 
>answer right.
>
>I will try one more time :)
>
>For the ModCounter class, the compiler provides the assignment operator by 
>default if you do not write one. This simply calls the Counter(Base) 
>operator= and then does a bit-wise copy of ModCounter's data like the limit 
>of the ModCounter.
>
>So we have to overwrite this default assignment operator by writing our own 
>if the default one doesn't serve the purpose.
>
>This can be done by writing
>
>const Counter& ModCounter::operator =(const ModCounter& mCtr);
>
>If you simply write
>
>const Counter& ModCounter::operator =(const Counter& other)
>
>you are just overloading the operator= function. The default operator= is 
>still present.
>

Very well stated. That's perfect.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-484-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 06:29:40 2003
Return-Path: <uhcosc1320-return-484-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74BTe5Z1548437
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 06:29:40 -0500 (CDT)
Received: (qmail 15080 invoked by uid 108); 4 Aug 2003 11:34:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11557 invoked from network); 4 Aug 2003 11:30:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041125.h74BPINM1529997@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 06:25:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Derived::operator== question (fwd)
Status: O
X-UID: 479
Content-Length: 709
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>If I declare
>
>1. bool ModCounter::operator==(const Counter& Ctr) const
>
>do I still need
>
>2. bool ModCounter::operator==(const ModCounter&) const.
>
>My answer is no because even if I pass a ModCounter object to the function, 
>since it is also a Counter object, the first operator== function will be 
>called anyways even if I don't write the second operator== function.
>
>Thanks,

While your reasoning is correct, if I write one any ways,
it will be more efficient since no dynamic casting will be needed
in the second version.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-485-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:27:57 2003
Return-Path: <uhcosc1320-return-485-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74IRu5Z1236240
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:27:56 -0500 (CDT)
Received: (qmail 7616 invoked by uid 108); 4 Aug 2003 18:33:03 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5388 invoked from network); 4 Aug 2003 18:30:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041825.h74IPDBm1232886@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:25:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Re: Run time error!  - Assignment 3 (fwd)
Status: O
X-UID: 480
Content-Length: 340
X-Keywords: $NotJunk                                                                                           

>Here are you talking about needing in our ModCounter the assignment operator=, where we assign one object to another, and the operator== where we compare two objects?  Thanks

Yes.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-486-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:28:11 2003
Return-Path: <uhcosc1320-return-486-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74ISB5Z1237247
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:28:11 -0500 (CDT)
Received: (qmail 8018 invoked by uid 108); 4 Aug 2003 18:33:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24442 invoked from network); 4 Aug 2003 18:14:45 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041809.h74I9WJj1179506@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:09:32 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Code review .... (fwd)
Status: O
X-UID: 481
Content-Length: 1893
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>I was wondering if you could take a look at my program.
>Considering I got a ?? on my last program...I'm really hoping for a 100 this 
>time around.
>I haven't yet put the Invalid exception in yet because I am stumped on that 
>part and waiting for your email on that topic. But other than that can you 
>please let me know if there are any other issues that I need to address 
>before sending it in tomorrow.
>
>Thank you for you time and being such a wonderful teacher!

Here are some general comments from reviewing your code.
This should be useful for others as well.

1. I see that you have written the comments fairly well. That is good.
2. You are keeping a value of count in your ModCounter. This is trouble
	waiting to happen. The Counter base already has the value
	and you should use it. Do not put any thing other variables than limit
	in your ModCounter.
3. In your class you need to have two implementations for operator=.
	Previous emails discussed this. Please reveiw those and make sure
	you take care of this.
4. I see that you have taken care of Law-of-Big-Three. That is good.
5. Do not override all the methods from the base class. Only override
	those you think really do some thing different from what the  base does.
6. Have you provided both pre- and post increment and decrement?
7. Your copy constructor is not correct. Revisit each method to make sure
	they are doing what they are supposed to be doing.
8. You are using dynamic_cast where it is not needed. You are casting
	a ModCounter pointer to ModCounter. There is no reason to do that.
9. Your operator== is not correct. Again, review each method to make sure
	it is doing what it is supposed to be doing. No more, no less.
10. Have you implemented all the methods that needs to be implemented?
	Previous emails pretty much have given clues to code of what
	you need.

Hope this helps.

Venkat

From uhcosc1320-return-487-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:30:25 2003
Return-Path: <uhcosc1320-return-487-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74IUP5Z1241163
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:30:25 -0500 (CDT)
Received: (qmail 9982 invoked by uid 108); 4 Aug 2003 18:35:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1905 invoked from network); 4 Aug 2003 18:26:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041821.h74IL1CA1207669@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:21:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Use of pointers or referece- Assignment 3 (fwd)
Status: O
X-UID: 482
Content-Length: 714
X-Keywords: $NotJunk                                                                                           

>Hello Venkat
>
>In this assignment when using dynamic_casting do you want us to use pointers or references since the use of -> is a bad practise or its okay to use either.
>

Please refer to previous emails on this topic.

>If we have to use references to check if the reference was assigned something, is this the proper way to do it
>
>if(&refOther!=0)
>{.....
>}
>
>Thanks Alot

Please refer to previous emails on this topic.

Visit http://www.cs.uh.edu/~svenkat/summer2003/mailstoclass

and look for the following words:
1. bad_cast
2. keep it simple

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-488-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:31:17 2003
Return-Path: <uhcosc1320-return-488-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74IVG5Z1248074
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:31:16 -0500 (CDT)
Received: (qmail 10729 invoked by uid 108); 4 Aug 2003 18:36:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7257 invoked from network); 4 Aug 2003 18:32:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041827.h74IRRjJ1224690@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:27:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Regarding Assign3 (fwd)
Status: O
X-UID: 483
Content-Length: 854
X-Keywords: $NotJunk                                                                                           

>Regarding the warnings of "not all control paths return a value" is it okay for me to do the following for the operator++:
>...deleted...
>  Here if the first condition doesn't match, I want to reset it, but no reason for a return value.  But by placing "return *this" at the end, I get rid of the warning for this method, the code works correctly.  Is this kind of correct?  Thanks.

The bottom line is all paths should return results. Second, 
the logic should be correct. As long as you can take care of it,
that is great. I had some suggestions as to how to write better
code and address this in earlier emails.

Look for the following in previous emails: "one return" (without the
quotes).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-489-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:32:52 2003
Return-Path: <uhcosc1320-return-489-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74IWp5Z1243365
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:32:52 -0500 (CDT)
Received: (qmail 12081 invoked by uid 108); 4 Aug 2003 18:37:54 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10417 invoked from network); 4 Aug 2003 18:36:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041830.h74IUmtT1211094@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:30:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Derived::operator== question (fwd)
Status: O
X-UID: 484
Content-Length: 831
X-Keywords: $NotJunk                                                                                           

>1. bool ModCounter::operator==(const Counter& Ctr) const
>2. bool ModCounter::operator==(const ModCounter&) const.
>  If I send a object of ModCounter, will it go directly to the second method because its a direct match with the parameter?  If so, whenever we send an object of ModCounter, it will always go to the second method. And if we have a Counter object, it will always go to the first method.  Doesn't it seem like we are creating methods for the different possibility of parameters?  Thanks.

Indeed. Note that it will also go to the first method if the
parameter is a reference of Counter (even though the reference will
be referring to the ModCounter object).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-490-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:33:46 2003
Return-Path: <uhcosc1320-return-490-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74IXj5Z1255165
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:33:45 -0500 (CDT)
Received: (qmail 13063 invoked by uid 108); 4 Aug 2003 18:38:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2866 invoked from network); 4 Aug 2003 18:27:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041822.h74IMEqW1569590@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:22:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] test case (fwd)
Status: O
X-UID: 485
Content-Length: 610
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Will you tell me how to use the test case?  Is that the main?  What files do I use?
>
>Thank You,

I hope when you are writing code, you not only test your code with
the main I have given, but write more code to test it. What I gave
you is just one such code you should have written by yourself.
Put it in main or write it as a separate function and call it from
main. It does not matter how you use it, it matters that you test
your code.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-491-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:34:24 2003
Return-Path: <uhcosc1320-return-491-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74IYO5Z1243064
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:34:24 -0500 (CDT)
Received: (qmail 13798 invoked by uid 108); 4 Aug 2003 18:39:26 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29996 invoked from network); 4 Aug 2003 18:20:56 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041815.h74IFgKb1197187@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:15:42 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Wrong values (fwd)
Status: O
X-UID: 486
Content-Length: 844
X-Keywords: $NotJunk                                                                                           

>Would you please look at my code.  I need help figuring out why I keep getting the wrong values.  Thanks!
>

In  your operator++, you have
>	if ((limit-1) > Counter::getCounterValue())
>     {
>		 Counter::operator ++();
>		 return *this;
>     }
>     else 
>          return *this;
>}

So, if the counter value is equal to limit - 1, what should be done?
Read the specs and you will see you are missing a call.

Some of the other methods (more than one) are not implemented correctly
as well. Review them. It is important that you understand the logic first,
then code. Use a paper and pencil if you need to figure out the logic.
If the logic is wrong, the code will not be correct.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-492-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:34:45 2003
Return-Path: <uhcosc1320-return-492-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74IYj5Z1240746
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:34:45 -0500 (CDT)
Received: (qmail 14127 invoked by uid 108); 4 Aug 2003 18:39:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11329 invoked from network); 4 Aug 2003 18:37:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041831.h74IVk2a1248013@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:31:46 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Derived::operator== question (fwd)
Status: O
X-UID: 487
Content-Length: 888
X-Keywords: $NotJunk                                                                                           

>Do you require that we have two methods as defined below for this assignment?  Thank you.
>

This is for you to decide.

Venkat

>> >Hi Venkat,
>>
>>If I declare
>>
>>1. bool ModCounter::operator==(const Counter& Ctr) const
>>
>>do I still need
>>
>>2. bool ModCounter::operator==(const ModCounter&) const.
>>
>>My answer is no because even if I pass a ModCounter object to the
>function, 
>>since it is also a Counter object, the first operator== function will be 
>>called anyways even if I don't write the second operator== function.
>>
>>Thanks,
>
>While your reasoning is correct, if I write one any ways,
>it will be more efficient since no dynamic casting will be needed
>in the second version.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475

From uhcosc1320-return-493-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:35:07 2003
Return-Path: <uhcosc1320-return-493-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74IZ65Z1255060
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:35:06 -0500 (CDT)
Received: (qmail 14831 invoked by uid 108); 4 Aug 2003 18:40:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4170 invoked from network); 4 Aug 2003 18:29:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041823.h74INpor1229455@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:23:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Re: Assignment 3 Check and Invalid class (fwd)
Status: O
X-UID: 488
Content-Length: 611
X-Keywords: $NotJunk                                                                                           

>Thank you so much!
>And also about , I noticed that counter.h had the "Invalid" class but since 
>it didn't have anything within the class I thought we had to recreate a new 
>one. I guess my thinking on this is wrong. I'll think about it today and try 
>to figure something out.
>
The (empty) implementation of Invalid class is given. 
You simply have to use it.

>Thanks again! :)
>Have a great day!

I promise I will try my best to do just that. :)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-494-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:43:25 2003
Return-Path: <uhcosc1320-return-494-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74IhO5Z1252706
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:43:24 -0500 (CDT)
Received: (qmail 21931 invoked by uid 108); 4 Aug 2003 18:48:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31816 invoked from network); 4 Aug 2003 18:23:08 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041817.h74IHsto1210190@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:17:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Derived::operator== question (fwd)
Status: O
X-UID: 489
Content-Length: 854
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
> 
>I had thought I had understood it very well:
> 
>"The derived class may override function defined in the base class, the overriden function should have the same signature and return type."
> 
>But in the following mail u r saying that
> 
>1. bool ModCounter::operator++(const ModCounter& ctr)const
> 
>is more efficient than
> 
>2. bool ModCounter::operator++(const Counter& ctr)const
> 
>Aren't we using different "signatures" and hence r rather hiding the functions from each other.
> 
>Thanks

It is hiding if you only provide the item 1 above. That is why you 
override and at the same time overload in the derived class.
You will write both the versions in the derived class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-495-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 13:46:39 2003
Return-Path: <uhcosc1320-return-495-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74Ikc5Z1269900
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 13:46:39 -0500 (CDT)
Received: (qmail 24661 invoked by uid 108); 4 Aug 2003 18:51:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20718 invoked from network); 4 Aug 2003 18:47:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041841.h74IfqKL1239989@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:41:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Operator =  Question (fwd)
Status: O
X-UID: 490
Content-Length: 1342
X-Keywords: $NotJunk                                                                                           

>Could you please look at my code.  It is giving me the correct output but I'm not sure about the operator =.  Earlier today, you told me that I had to have two operator ='s but I'm not really understanding it.  Could you please explain.  If I just have the operator=(const Base&) it works fine, but yet I know I need the other one.  Please help me understand why.  I've looked at the bonus question answer and yet it is still not clear to me what I should be implementing.  Could you see if what I've done is correct.  Thank you!
>
>...deleted...

Writing two operator= will ensure that the correct implementation of
the operator= will be called no matter how you assign the objects,
as

derived1 = derived2;

or 

baseRef1 = baseRef2;

If you do not write a operator= that takes a const ModCounter& as argument,
the compiler writes one and it will mess up and not implement the
assignment correctly. 

If you do not write the operator= that takes a const Counter& as argument,
then the operator=(const ModCounter&) hides the one in base and
so if you call baseRef1 = baseRef2 (where baseRef1 and baseRef2 are
Counter references referring to ModCounter objects), then it will end up
calling the operator= in Counter instead of your class.

Writing both ensures that the method will be implemeted the same no
matter how it is called.

Venkat

From uhcosc1320-return-496-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 14:02:19 2003
Return-Path: <uhcosc1320-return-496-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74J2J5Z1329702
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 14:02:19 -0500 (CDT)
Received: (qmail 5226 invoked by uid 108); 4 Aug 2003 19:07:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15967 invoked from network); 4 Aug 2003 18:41:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308041836.h74IaA2f1263168@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 13:36:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] return values (fwd)
Status: O
X-UID: 491
Content-Length: 509
X-Keywords: $NotJunk                                                                                           

>For the following method I get a warning about that not all control paths return a value.
>
>...deleted...
>How am I suppose to return a value if modcntr==0 or if the limits are not the same.  Any suggestions?  Thanks a lot.  


Yes. Please visit http://www.cs.uh.edu/~svenkat/summer2003/mailstoclass
and look for "one return" (without the quotes).


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-497-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 15:14:14 2003
Return-Path: <uhcosc1320-return-497-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74KEE5Z1546681
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 15:14:14 -0500 (CDT)
Received: (qmail 30514 invoked by uid 108); 4 Aug 2003 20:19:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28275 invoked from network); 4 Aug 2003 20:16:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042011.h74KBFFc1550175@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 15:11:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Operator =  Question (fwd)
Status: O
X-UID: 492
Content-Length: 380
X-Keywords: $NotJunk                                                                                           

>So what you are saying is that we have to call one operator= from the other?  If so, how is that implemented?  Any hints?

Oh that's easy. Just try it and you will figure it out. Any hint
has to show you the actual code!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-498-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 15:24:29 2003
Return-Path: <uhcosc1320-return-498-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74KOS5Z1062522
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 15:24:28 -0500 (CDT)
Received: (qmail 11064 invoked by uid 108); 4 Aug 2003 20:29:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8011 invoked from network); 4 Aug 2003 20:27:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042022.h74KM57Q1569031@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 15:22:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Incrementing ModCounter (fwd)
Status: O
X-UID: 493
Content-Length: 877
X-Keywords: $NotJunk                                                                                           

>Am having a problem in assign 3.
>
>If I include following in my  main code
>
>MicroCounter mca(2);
>MicroCounter mcb(2);
>
>mcb = ++mca;
>
>it preincrements mca alright,  then bcoz "op++" method of ModCounter  is returning 
>"Counter" type, the dynamic -cast in 'op=' method assigns "null " to 'aModCounter'  and hence an exception is thrown rather than doing the assignment.!!!(I could think of this as the only 
>reason for not getting correct result!!)
> 
>...deleted...
>Could you give any hint how to make it work right.
> 
>Thanks

This was discussed in an email sent on Friday.

Please visit http://www.cs.uh.edu/~svenkat/summer2003/mailstoclass
and look for "much can be done about this" (without the quote).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-499-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 15:24:36 2003
Return-Path: <uhcosc1320-return-499-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74KOa5Z1557710
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 15:24:36 -0500 (CDT)
Received: (qmail 11278 invoked by uid 108); 4 Aug 2003 20:29:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32110 invoked from network); 4 Aug 2003 20:20:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042015.h74KFjAg1553782@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 15:15:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Correct implementation for ++, and -- (fwd)
Status: O
X-UID: 494
Content-Length: 361
X-Keywords: $NotJunk                                                                                           

>Would these be the correct way to implement post and pre ++ and -- in the ModCounter.h file
>
>Thanks 
>...deleted...

At first glance they look OK.  I will let you decide for sure if they
are correct.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-500-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 15:27:05 2003
Return-Path: <uhcosc1320-return-500-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74KR45Z1072069
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 15:27:04 -0500 (CDT)
Received: (qmail 15127 invoked by uid 108); 4 Aug 2003 20:32:07 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1731 invoked from network); 4 Aug 2003 20:22:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042017.h74KHexa1538723@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 15:17:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Derived::operator== question (fwd)
Status: O
X-UID: 495
Content-Length: 1504
X-Keywords: $NotJunk                                                                                           

>I am sorry but I need to understand this.
>We need to override and also overload "operator=" bcoz otherwise it will use the defualt
>'operaor=' of the ModCounter class.
>But why do we need two "opeartor++" methods.There is no default "operator++".
> 
>I am very confused.
>Please mail.Bcoz if I am wrong I am thinking very all wrong.

Sorry, my mistake. When I read your email, I read it as meaning
operator= and not operator++.

Why would you write operator++ as shown below any ways.

So, my response shown below is for operator= and not operator++.

Venkat

>Thanks
>
>"Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU> wrote:
>>Hi Venkat
>> 
>>I had thought I had understood it very well:
>> 
>>"The derived class may override function defined in the base class, the overriden function should have the same signature and return type."
>> 
>>But in the following mail u r saying that
>> 
>>1. bool ModCounter::operator++(const ModCounter& ctr)const
>> 
>>is more efficient than
>> 
>>2. bool ModCounter::operator++(const Counter& ctr)const
>> 
>>Aren't we using different "signatures" and hence r rather hiding the functions from each other.
>> 
>>Thanks
>
>It is hiding if you only provide the item 1 above. That is why you 
>override and at the same time overload in the derived class.
>You will write both the versions in the derived class.
>
>Venkat Subramaniam
>-- 
>cosc155g@bayou.uh.edu Department of Computer Science
>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-501-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 15:28:39 2003
Return-Path: <uhcosc1320-return-501-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74KSd5Z1079575
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 15:28:39 -0500 (CDT)
Received: (qmail 17344 invoked by uid 108); 4 Aug 2003 20:33:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30715 invoked from network); 4 Aug 2003 20:19:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042014.h74KEDgp1557312@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 15:14:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Not getting any response for my e-mails,help (fwd)
Status: O
X-UID: 496
Content-Length: 1062
X-Keywords: $NotJunk                                                                                           

>Hello
> 
>I am worried.I am not getting any response of my e-mails(I sent 3 long ones ). I am feeling left out with no one to communicate with to discuss my problems with.
>Please help.
>I am (making) and sending the last one again.
> 
>"The derived class may override a virtual funtion defined in the main class and this overridden fn shd have same "signature" and "return type."
> 
>But in following mail u said using
> 
>1 .bool ModCounter::operator==(const ModCounter&) const.
>
>will be more efficient than using
> 
>2.  bool ModCounter::operator==(const Counter& Ctr) const
> 
>But isn't (the first one)it  doing hiding rather than overriding bcoz signature are not exactly " same'.
>Thanks
> 
>Please mail back.

It is hiding if you only provide the item 1 above. That is why you
override and at the same time overload in the derived class.
You will write both the versions in the derived class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-502-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 15:37:08 2003
Return-Path: <uhcosc1320-return-502-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74Kb85Z1099972
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 15:37:08 -0500 (CDT)
Received: (qmail 27382 invoked by uid 108); 4 Aug 2003 20:42:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22137 invoked from network); 4 Aug 2003 20:37:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042032.h74KW76i1447980@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 15:32:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Operator= and == and ++ (fwd)
Status: O
X-UID: 497
Content-Length: 1550
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I am totally confused.  How many duplicate methods do we need in our ModCounter?  I have written and submitted what I thought worked.  But, all the emails that are flying are makeing me worry, my testing was not robust enough.  My code worked fine for a single overwritten operator methods.  I didn't have to make non-virtual methods at all.  I don't think I understand this concept.  I have written test code to try and show that my code doesn't work.  I even copied the test code from some emails and implemented it.  I am not breaking my code that is supposedly not right.  What am I not doing properly?  I have tried writing the code on what has been said; however, since I don't understand why my code is not effective for some cases I don't have a clue if I am doing it correctly.  Can you look at my code and let me know where I have gone wrong or where I am not though enough.
>

Let's start by asking as simple question. Are you following law of
big three?

The law says if you write destructor or copy constructor or 
operator=, then you need all the three. 

The signature of operator= for a class X for the purpose of 
law of big three is

operator=(const X&) 

and not

operator=(const BaseOfX&).

Now, try some thing.

ModCounter m1(4);
ModCounter m2(2);
Counter& c1 = m1;
Counter& c2 = m2;

m1 = m2;
c1 = c2;

What does your code do for the above two assignments?.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-503-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 15:43:52 2003
Return-Path: <uhcosc1320-return-503-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74Khq5Z1124148
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 15:43:52 -0500 (CDT)
Received: (qmail 2111 invoked by uid 108); 4 Aug 2003 20:48:55 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25612 invoked from network); 4 Aug 2003 20:40:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042035.h74KZHs11099823@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 15:35:17 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: [uhcosc1320] Derived::operator== question (fwd)
Status: O
X-UID: 498
Content-Length: 1443
X-Keywords: $NotJunk                                                                                           

>Can this be an example of extensibility as far as not having to change the first method but just create the second method?  

I do not see it as one.

Venkat

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/04/03 01:30 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: Re: [uhcosc1320] Derived::operator== question (fwd)
>
>> 
>> >1. bool ModCounter::operator==(const Counter& Ctr) const
>>2. bool ModCounter::operator==(const ModCounter&) const.
>>  If I send a object of ModCounter, will it go directly to the second
>method because its a direct match with the parameter?  If so, whenever we send 
>an object of ModCounter, it will always go to the second method. And if we 
>have a Counter object, it will always go to the first method.  Doesn't it
>seem like we are creating methods for the different possibility of
>parameters?  Thanks.
>
>Indeed. Note that it will also go to the first method if the
>parameter is a reference of Counter (even though the reference will
>be referring to the ModCounter object).
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-504-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 15:46:16 2003
Return-Path: <uhcosc1320-return-504-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74KkD5Z1128560
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 15:46:13 -0500 (CDT)
Received: (qmail 4693 invoked by uid 108); 4 Aug 2003 20:51:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 898 invoked from network); 4 Aug 2003 20:47:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042042.h74KgbOV1108304@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 15:42:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Data Structures (fwd)
Status: O
X-UID: 499
Content-Length: 659
X-Keywords: $NotJunk                                                                                           

>With your deep knowledge of programming and great method of teaching, I was wondering if you had any future plans on teaching data structures?  
>

Thanks for your interest. I generally teach the following courses at UH:

1320 OOP in C++ - Summer
4319 Distributed Object Computing (Web Services in .NET) - Fall
6318 Object-Oriented Analysis and Design - Spring

This may change, but as of now, this is the plan.

By the way, some undergraduate students do take my graduate course 6318
as elective :)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-505-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 16:30:14 2003
Return-Path: <uhcosc1320-return-505-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74LUD5Z1259823
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 16:30:13 -0500 (CDT)
Received: (qmail 12251 invoked by uid 108); 4 Aug 2003 21:35:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29962 invoked from network); 4 Aug 2003 20:44:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042039.h74KdBh41111264@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 15:39:11 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Future of Object Oriented Programming (fwd)
Status: O
X-UID: 500
Content-Length: 2062
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>Please correct me if I am wrong,
>Object Oriented Programming is a style of programming
>just like other styles of programming available, but
>Object Oriented approach has many benefits.
>
>When people started to understand the benefits of
>implementing their code using Object Oriented
>Paradigm, they decided to use Object Oriented approach
>in all their new application.
>As a result, we saw plenty of jobs in the market for
>Object Oriented developers.  
>
>I would like to know are there are any other
>programming styles in use nowadays which may supercede
>the advantages of Object Oriented concepts in future?
>
>You have talked about the advantages of Object
>Oriented Programming, can you please tell us if you
>'ve experienced any shortcomings/drawbacks of Object
>Oriented concepts?  I am not questioning for the
>systems that were poorly implemented using OO
>concepts, rather I am interested to find out if you
>have witnessed any projects failure because Object
>Oriented Paradigm was used in the project.
>
>Also, I would like to know if there could be any
>circumstances when a company might decide not to use
>Object Oriented Paradigm in their new application.  If
>they do, what alternative do they resort to,
>Structural programming?
>

Very good question. In fact, I recently gave a talk at the
Houston ACM chapter on this topic. You are most welcome to
download the presentation if you are interested from
http://www.agiledeveloper.com/download.aspx 
Click on "Aspect Oriented Programming." 

>
>Finally, you 've said earlier this semester that you
>no longer program in C++ and will tell us your reasons
>for not choosing C++ as an application development
>language, I am waiting to hear from you on that,
>please do not forget because we are approaching the
>end of semester.
>
>
>Thank you very much

:) !! We will talk about this on the last day of the class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-506-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 17:53:18 2003
Return-Path: <uhcosc1320-return-506-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74MrH5Z1519512
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 17:53:17 -0500 (CDT)
Received: (qmail 10455 invoked by uid 108); 4 Aug 2003 22:58:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4291 invoked from network); 4 Aug 2003 22:50:18 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042245.h74Mj3cJ1406738@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 17:45:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Operator= and == and ++ (fwd)
Status: O
X-UID: 501
Content-Length: 1408
X-Keywords: $NotJunk                                                                                           

>The way my original code worked was when it saw m1=m2; it stepped straight to the next line of code when I hit the step-into button.  Then my when my code saw c1=c2; it stepped into the ModCouner method and then the Counter method.
>
>I figure I was not following the law of big three.  Stated the way you stated it.  So I put in a new operator= with the syntax for a plan assignment operator in ModCounter.  Now the m1=m2; line goes to the non-virtual ModCounter operator= first then to the Counter operator=(because I call it in my code).
>
>I guess my next question is why did it just step over and not let me know it was using a default assignment operator.  It has no problem throwing me into machine code during an error.  I mean of course when I am in debug mode.  
>
>Is this what it is supposed to do?  Have I traced it properly?

If you put a break point in the Counter's operator= and then
step over m1 == m2, you will see that it hits the break point.
Then look at the call stack and you will see that the code 
is actually called from the ModCounter's automatically provided
operator=. One reason why step in did not work may be because
the method was inlined and since the source code is not available,
there was nothing to step into.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-507-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 18:01:41 2003
Return-Path: <uhcosc1320-return-507-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h74N1f5Z1540365
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 18:01:41 -0500 (CDT)
Received: (qmail 16819 invoked by uid 108); 4 Aug 2003 23:06:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6818 invoked from network); 4 Aug 2003 22:53:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308042248.h74MmfNT1495934@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 17:48:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator =, accessing limit (fwd)
Status: O
X-UID: 502
Content-Length: 1107
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I think I've grasped the need to have a separate operator for Counter as well 
>as ModCounter but now I'm having difficulty with the Counter implementation.
>
>...deleted...
>
>The other object is returned as a Counter so therefore, my getLimit() 
>function (written in ModCounter) will not be available for other.  But the function 
>would not go into that body of code if it wasn't a ModCounter.  Should I 
>type-cast the other to make it a ModCounter?  Is there a better way of doing this?  
>Or am I completely mistaken altogether?  Please help.  Thanks for you all your 
>help!

Once you dymamic cast, the pointer is valid if the other object
is a ModCounter. Now that you have the pointer, you can use
the pointer to call method on the other ModCounter!

const ModCounter* pOtherModCounter = dynamic_cast<const ModCounter*> (&other);

if (pOtherModCounter != 0)
{
	int limitOfOtherModCounter = pOtherModCounter->getLimit();
	...
}

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-508-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 21:15:04 2003
Return-Path: <uhcosc1320-return-508-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h752F45Z1083944
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 21:15:04 -0500 (CDT)
Received: (qmail 18211 invoked by uid 108); 5 Aug 2003 02:20:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16281 invoked from network); 5 Aug 2003 02:17:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308050211.h752BkWp1560061@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 21:11:46 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Data Structures (fwd)
Status: O
X-UID: 503
Content-Length: 245
X-Keywords: $NotJunk                                                                                           

>Very enticing, what are the prerequisites for course 6318?

1320 and Data Structures!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-509-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 21:16:23 2003
Return-Path: <uhcosc1320-return-509-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h752GN5Z1089897
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 21:16:23 -0500 (CDT)
Received: (qmail 19330 invoked by uid 108); 5 Aug 2003 02:21:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17844 invoked from network); 5 Aug 2003 02:19:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308050214.h752EQl91063042@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 21:14:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator== problem (fwd)
Status: O
X-UID: 504
Content-Length: 670
X-Keywords: $NotJunk                                                                                           

>Dear Venkat-
>
>i've been sitting here trying to figure out what is
>wrong with my program. it runs fine when i run your
>original main but when i try the test code you sent in
>the e-mail it gives me the output:
>
>
>mc1==mc2:Error
>Again mc1==mc2:1   <--  This should be Error as well?
>
>i don't mean to bother you but i can't seem to locate
>the problem. i have attached my code in zip file. i
>think it has to do with my operator== but still i
>dunno exactly where. if you find time can you give me
>a hint as to where i'm messing up?
>
>thank you for your time

You need to implement operator== that takes const Counter& as 
argument. That should fix it.

Venkat

From uhcosc1320-return-510-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 21:20:24 2003
Return-Path: <uhcosc1320-return-510-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h752KN5Z1254653
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 21:20:23 -0500 (CDT)
Received: (qmail 22097 invoked by uid 108); 5 Aug 2003 02:25:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20091 invoked from network); 5 Aug 2003 02:22:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308050217.h752HLeM1089863@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 21:17:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question from today's class (fwd)
Status: O
X-UID: 505
Content-Length: 665
X-Keywords: $NotJunk                                                                                           

>Someone asked today what happens when you have the following:
>
>ModCounter m1= c1;  where c1 is an object of Counter.
>
>Did you reply that the operator=  is called whose parameter is an object of type Counter? And from there, the method does dynamic cast to see whats the real type of the right hand operand and from there make the necessary assignments or not.  Is this correct?  THanks. 
>

I would exect this to be a compilation error.
There is no polymorphism when it comes to calls to constructors.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-511-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 22:48:41 2003
Return-Path: <uhcosc1320-return-511-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h753mf5Z1357570
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 22:48:41 -0500 (CDT)
Received: (qmail 10655 invoked by uid 108); 5 Aug 2003 03:53:45 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9033 invoked from network); 5 Aug 2003 03:50:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308050345.h753jfqa1356597@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 22:45:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator= (fwd)
Status: O
X-UID: 506
Content-Length: 491
X-Keywords: $NotJunk                                                                                           

>When I try my operator= with two ModCounter, I figured the output would be one instead of zero as shown below
>
>
...deleted...
>
>How come when I print this, it doesn't say : "mc1=mc2:: 1" since I had incremented mc2?  Instead, it gives me "mc1=mc2::0".  Thanks.

You may want to take a look at the example I wrote it class today.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-512-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 22:50:52 2003
Return-Path: <uhcosc1320-return-512-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h753op5Z1367991
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 22:50:51 -0500 (CDT)
Received: (qmail 12148 invoked by uid 108); 5 Aug 2003 03:56:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10028 invoked from network); 5 Aug 2003 03:52:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308050347.h753lJU71367958@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 22:47:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] ++, -- question (fwd)
Status: O
X-UID: 507
Content-Length: 716
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>in my program when i do this 
>Counter c5;
>Counter c6;
>
>c5=c6++;
>and then print the value out from getValue the increment works fine. It works for all post and pre( ++ and --).
>
>But the same doesnt seem to work for
>ModCounter a4;
>ModCounter a5;
>a5=a4++.
>GetValue just prints a 0.
>
>Where am i going wrong in my implementation, or is that not required for this program.
>
>Thanks Alot

In the second case, I would have expected it to throw an exception
actually. Revisit your operator= methods and make sure the logic is
correct.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-513-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug  4 23:03:55 2003
Return-Path: <uhcosc1320-return-513-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h7543t5Z1413180
	for <cosc155g@bayou.uh.edu>; Mon, 4 Aug 2003 23:03:55 -0500 (CDT)
Received: (qmail 19555 invoked by uid 108); 5 Aug 2003 04:08:54 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8276 invoked from network); 5 Aug 2003 03:49:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308050344.h753iUcD1353989@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 4 Aug 2003 22:44:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator= (fwd)
Status: O
X-UID: 508
Content-Length: 563
X-Keywords: $NotJunk                                                                                           

>I talked to you after class regarding the operator= and the need for it, if one is not supplied.  When we have two operator=, one will be from the Counter class, correct?  And the other will be the one we create, which is not from the Counter class.  Is this train of thought correct?  THanks.

Seems like. Make sure you receive as parameter a const reference to the 
appropriate type when you write it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-514-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug  5 07:43:36 2003
Return-Path: <uhcosc1320-return-514-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h75Cha5Z1371761
	for <cosc155g@bayou.uh.edu>; Tue, 5 Aug 2003 07:43:36 -0500 (CDT)
Received: (qmail 21258 invoked by uid 108); 5 Aug 2003 12:48:46 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14006 invoked from network); 5 Aug 2003 12:38:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308051233.h75CX9rG1332838@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 5 Aug 2003 07:33:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] VTable (fwd)
Status: O
X-UID: 509
Content-Length: 372
X-Keywords: $NotJunk                                                                                           

>Venkat,
>Will the virtual destructor such as virtual ~car() be
>included in the VTable?
>
>Thanks

Absolutely, if the destructor is virtual, it will appear in 
the VTable. We will talk about this in class today.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-515-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug  5 07:45:45 2003
Return-Path: <uhcosc1320-return-515-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h75Cjj5Z1368568
	for <cosc155g@bayou.uh.edu>; Tue, 5 Aug 2003 07:45:45 -0500 (CDT)
Received: (qmail 23134 invoked by uid 108); 5 Aug 2003 12:50:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17440 invoked from network); 5 Aug 2003 12:43:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308051238.h75CcGIH1333735@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 5 Aug 2003 07:38:16 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Static Functions (fwd)
Status: O
X-UID: 510
Content-Length: 892
X-Keywords: $NotJunk                                                                                           

>Sorry I worded my question in a very wrong way.
>Overriding any non virtual function will cause hiding and this also 
>applies to static functions. I mean that overriding a static function 
>will also result in hiding. 
>Right??

You see static functions are never called on objects. One of my 
recommendations is to not call static method using objects because
this is confusing to say the least. 

Let's say foo is a static method in A.

If you write

A obj;
obj.foo();

The compiler will replace this with

A::foo(); at compile time.

When ever you see a static method, read it as being called on the
class and not on the object.

There is no concept of polymorphism on static methods. Static methods
are always statically bound.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-516-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug  5 07:51:42 2003
Return-Path: <uhcosc1320-return-516-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h75Cpf5Z1389651
	for <cosc155g@bayou.uh.edu>; Tue, 5 Aug 2003 07:51:41 -0500 (CDT)
Received: (qmail 27621 invoked by uid 108); 5 Aug 2003 12:56:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13502 invoked from network); 5 Aug 2003 12:37:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308051232.h75CWX6U1335881@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 5 Aug 2003 07:32:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] courses teaching at UH (fwd)
Status: O
X-UID: 511
Content-Length: 489
X-Keywords: $NotJunk                                                                                           

>Venkat,
>What other classes will you be teaching in the Fall'03
>and Spring' 04.
>
>Thanks

I generally teach the following courses at UH:

1320 OOP in C++ - Summer
4319 Distributed Object Computing (Web Services in .NET) - Fall
6318 Object-Oriented Analysis and Design - Spring

This may change, but as of now, this is the plan.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-517-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug  5 23:08:30 2003
Return-Path: <uhcosc1320-return-517-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h7648U5Z1484713
	for <cosc155g@bayou.uh.edu>; Tue, 5 Aug 2003 23:08:30 -0500 (CDT)
Received: (qmail 28885 invoked by uid 108); 6 Aug 2003 04:13:44 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23217 invoked from network); 6 Aug 2003 04:05:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308060400.h76405fV1463265@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 5 Aug 2003 23:00:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Visio for UML (fwd)
Status: O
X-UID: 512
Content-Length: 348
X-Keywords: $NotJunk                                                                                           

>If we have access to Visio, can we use that to draw the diagrams for HW4?

You may use any thing you please and have access to. A hand drawn
sketch (pencil or pen that is) is fine as well.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-518-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug  5 23:19:57 2003
Return-Path: <uhcosc1320-return-518-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h764Ju5Z1515634
	for <cosc155g@bayou.uh.edu>; Tue, 5 Aug 2003 23:19:56 -0500 (CDT)
Received: (qmail 4230 invoked by uid 108); 6 Aug 2003 04:25:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26788 invoked from network); 6 Aug 2003 04:10:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308060405.h7645MgT1475815@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 5 Aug 2003 23:05:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] bonus points (fwd)
Status: O
X-UID: 513
Content-Length: 819
X-Keywords: $NotJunk                                                                                           

>Dr Venkat,
>
>I was wondering since we still have 10 bonus ponits up for grab. Would =
>you be kind enough to maybe give like a problem or homework worth =
>10point, sort of like a 5th homework and porbably the 1st 5 people with =
>the right answer gets the 10points? This will really help to push up our =
>grade...
>
>Thanks

Sorry, the bonus points are intended to motivate people to try things
outside the scope of the course work. As far as grades, I try to keep 
it to what's specified in the syllabus. Further, our time is better
spent helping us learn than getting better grades. So, lets spend the 
time asking and answering more technical questions.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-519-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug  5 23:43:11 2003
Return-Path: <uhcosc1320-return-519-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h764hA5Z1572575
	for <cosc155g@bayou.uh.edu>; Tue, 5 Aug 2003 23:43:10 -0500 (CDT)
Received: (qmail 19191 invoked by uid 108); 6 Aug 2003 04:48:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24499 invoked from network); 6 Aug 2003 04:07:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308060401.h7641rtD1464983@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 5 Aug 2003 23:01:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Ques#4 on MidTerm3 Sum2002 (fwd)
Status: O
X-UID: 514
Content-Length: 827
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>  I'm not understand the question#4 on MidTerm# in Sum2002.
>"Mention 5 significant watch out/ don't dos in C++?"
>
>Are they the one you tell us to don't use or think about it?
>1, Friend
>2, Ellipse expect for catch(...)
>3, Multiple inherifances
>4, Function Hiding
>5, Dynamic Cast (only use it if you really necessary)
>
>Please, let me know if I misunderstand your question.
>
>Thanks a lot,

If you visit the directory where the examples from class are posted,
http://www.cs.uh.edu/~svenkat/summer2003/ExamplesFromClass
there is file named thingstoremember.txt which gives you these
details. More will be added to these in the next day or two.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-520-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 05:44:07 2003
Return-Path: <uhcosc1320-return-520-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76Ai15Z1064289
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 05:44:07 -0500 (CDT)
Received: (qmail 25631 invoked by uid 108); 6 Aug 2003 10:49:17 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24601 invoked from network); 6 Aug 2003 10:47:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061042.h76AgNgR1425532@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 05:42:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 4 posted
Status: O
X-UID: 515
Content-Length: 289
X-Keywords: $NotJunk                                                                                           

Greetings,

Assignment 4 has been posted. I hope it helps you understand the 
concepts of templates and namespaces further. Enjoy.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-521-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:24:17 2003
Return-Path: <uhcosc1320-return-521-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76BOH5Z1070069
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:24:17 -0500 (CDT)
Received: (qmail 18601 invoked by uid 108); 6 Aug 2003 11:29:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7861 invoked from network); 6 Aug 2003 11:12:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061107.h76B7Ekf1132335@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:07:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] operator= (fwd)
Status: O
X-UID: 516
Content-Length: 693
X-Keywords: $NotJunk                                                                                           

>I read in a C++ reference book that the operator= is not inheritable.
>Why is this so? Thanks =)

Since the signature of operator= has the type of the class in
the arguments, it is not as easy as writing just one method.
If a class B derives from A, and if you want to make the operator=
overridable, you have to both override and overload. When it
comes to classes which are deeper in the inheritance hieararchy,
this gets to be pretty difficult isn't it. That is why, operator=
is not easily overridable like the other methods are.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-522-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:24:55 2003
Return-Path: <uhcosc1320-return-522-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76BOs5Z1180229
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:24:54 -0500 (CDT)
Received: (qmail 19241 invoked by uid 108); 6 Aug 2003 11:30:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 400 invoked from network); 6 Aug 2003 11:00:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061055.h76AtWA61231063@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 05:55:32 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Vtable (fwd)
Status: O
X-UID: 517
Content-Length: 308
X-Keywords: $NotJunk                                                                                           

>Venkat, 
>   Is the vtable for vehicle given in the slides the complete vtable or is there more to it?  Thanks.

For the given code, it is complete.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-523-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:26:36 2003
Return-Path: <uhcosc1320-return-523-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76BQa5Z1187290
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:26:36 -0500 (CDT)
Received: (qmail 20441 invoked by uid 108); 6 Aug 2003 11:31:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4225 invoked from network); 6 Aug 2003 11:06:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061101.h76B14Zx1086158@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:01:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] in class example (fwd)
Status: O
X-UID: 518
Content-Length: 1978
X-Keywords: $NotJunk                                                                                           

>Regarding the following code done in class:
>
>#include <iostream>
>using namespace std;
>
>class Base
>{
>public:
>	virtual void f1() { cout << "Base::f1" << endl; }
>	void f2() { cout << "Base::f2" << endl; }
>	virtual void f3(int a)
>	{
>		cout << "Base::f3" << endl;
>	}
>};
>
>class Derived : public Base
>{
>public:
>	virtual void f1() { cout << "Derived::f1" << endl; }
>	void f2() { cout << "Derived::f2" << endl; }
>	virtual void f3(double a)
>	{
>		cout << "Derived::f3" << endl;
>	}
>};
>
>void main()
>{
>	Derived obj;
>	Base* ptr = &obj;
>
>	obj.f1();
>	obj.f2();
>	obj.f3(2);
>	cout << "----------" << endl;
>	ptr->f1();    // THIS IS DYNAMIC BIND, CORRECT?
>	ptr->f2();    // THIS IS STATIC BIND, BINDING TO
>BASE::f2, CORRECT?
>	ptr->f3(2);   // THIS IS DYNAMIC BIND, CORRECT?
>}
>

Looks reasonable.

>how come when it runs the codes "ptr->f2();" and "ptr->f3(2);" that it goes directly to the base class's method and not derived class's method, like it did when it ran "ptr->f1();"   Why does it act differently, when one goes to the derived class and the others don't.  Thanks for the clarification.

In the case of f2, it is statically bound to Base::f2. That means the compiler,
at compile time, has decided only to use Base::f2 and so irrespective of
the type of the object the pointer points to at run time, f2 is used.

In the case of f3, we have hiding since the signature is different.
At compile time, the compiler decided to use dynamic binding for f3. It
said, during run time, I will look for the method f3 which takes an int
in the class of the real type of the object the pointer points to.
Now, at run time, it goes to Derived and says, do you have a f3 which
takes an int. Since there is not f3 that takes an int in Derived, it
goes up the inheritance ladder and uses the one in Base.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-524-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:29:11 2003
Return-Path: <uhcosc1320-return-524-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76BTB5Z1112409
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:29:11 -0500 (CDT)
Received: (qmail 22196 invoked by uid 108); 6 Aug 2003 11:34:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10011 invoked from network); 6 Aug 2003 11:15:56 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061110.h76BAXbA1127489@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:10:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] acceptable format for hw4 (fwd)
Status: O
X-UID: 519
Content-Length: 443
X-Keywords: $NotJunk                                                                                           

>Venkat,
>	Can you tell me if a hard copy of this would be an acceptable format
>to turn in for HW4?  If so, does this contain what you're asking for in hw4?
>There are only 3 virtual calls that I can see in main().
>

Please keep the diagram as similar as possible to what's presented on
the slides. Show VTables the way its shown there. Show how the objects
are related as well. Do not show any thing else (like UML diagrams, etc.).

Venkat

From uhcosc1320-return-525-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:32:01 2003
Return-Path: <uhcosc1320-return-525-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76BW15Z1205153
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:32:01 -0500 (CDT)
Received: (qmail 24011 invoked by uid 108); 6 Aug 2003 11:37:16 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1473 invoked from network); 6 Aug 2003 11:02:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061056.h76Auqx21554579@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 05:56:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Test 3 on Friday (fwd)
Status: O
X-UID: 520
Content-Length: 539
X-Keywords: $NotJunk                                                                                           

>Venkat, I have a couple of questions about the test on Friday.  
>First off, what all is going to be covered on there?  Is it going 
>to be a cumulative test of everything, or just the topics since 
>test 2?  

Inheritance and Polymorphism.

>Also, when is the test supposed to be, and when is it 
>going to be?  Just curious.  Thanks 

It will be from 6-8PM Friday (August 8th).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-526-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:32:02 2003
Return-Path: <uhcosc1320-return-526-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76BW25Z1207961
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:32:02 -0500 (CDT)
Received: (qmail 24186 invoked by uid 108); 6 Aug 2003 11:37:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15693 invoked from network); 6 Aug 2003 11:25:27 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061120.h76BK5Ko1168068@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:20:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Midterm 3 review (fwd)
Status: O
X-UID: 521
Content-Length: 241
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>Will it be possible to have a review for our Midterm 3?
> 
>All the other reviews have really helped a lot.
> 
>Thanks,

Yes, we will start the review at 7:30PM tomorrow (Thursday) and go on 
until you all want to quit.

Venkat

From uhcosc1320-return-527-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:36:33 2003
Return-Path: <uhcosc1320-return-527-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76BaX5Z1531721
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:36:33 -0500 (CDT)
Received: (qmail 26874 invoked by uid 108); 6 Aug 2003 11:41:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6754 invoked from network); 6 Aug 2003 11:10:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061105.h76B5Ljl1122856@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:05:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Hiding again (fwd)
Status: O
X-UID: 522
Content-Length: 1130
X-Keywords: $NotJunk                                                                                           

> const B& operator=(const B& other)
>	{
>	cout << "called operator= of B" << endl;
>
>		A::operator=(other);
>		return *this;
>	}
>
>why did u code A::operator =(other)?? is this because
>Class A and class B are implented in the same file??
>
>Suppose u got 2 separate header it files, how will
>call the  operator = function?
>
>Thanks

Step back to some thing else for a minute.

Assume A has a method virtual void foo(int a).

In B, if I write virtual void foo(double a), we say this is 
hiding. If you change the signature of the method in the
derived class, it results in hiding. 

Please refer to the email prior to this one for more details.

Hiding is bad. So, the correct way to do this, if you still want
to have a foo which takes a double in B is to override and 
overload.

So, in B, we will write virtual void foo(int a) and virtual void foo(double a);

The same reason applies for operator=. Keep the signature consistent 
between the base and the derived.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-528-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:36:56 2003
Return-Path: <uhcosc1320-return-528-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76Bau5Z1222720
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:36:56 -0500 (CDT)
Received: (qmail 27201 invoked by uid 108); 6 Aug 2003 11:42:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15277 invoked from network); 6 Aug 2003 11:24:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061119.h76BJDI51155952@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:19:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] VTable question (fwd)
Status: O
X-UID: 523
Content-Length: 1604
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>I had a quick question regarding the order in a VTable diagram.
> 
>Please take this code into consideration:
> 
>Class A
>{
>public:
>            
>virtual ~A();
> 
>virtual void doSomthing();
> 
>virtual void trySomthing();
> 
> 
>};
> 
>Class B : public A
>{
>            public:
> 
>            virtual ~B();
> 
>virtual void GetValue();
> 
>virtual void DropValue();
> 
>virtual void doSomthing();
> 
>virtual void trySomthing();
> 
>virtual void buba();
>            
> 
>};
> 
> 
>My question comes in when creating the VTABLE for Class B, the order in
>which the methods are written in is based on the order of the BASE
>FIRST.then the order that you can above.right?
> 

That is correct. 

>Because eventhough GetValue() , DropValue() and buba() are not virtual
>functions of the base, they will not be taken into consideration for the
>ordering of the B Vtable. Well not initially.because we have to follow
>the order of the base correct?
> 
>Thanks for all your help!!
> 
> 
>Best regards,

It becomes easy if we understand why.

When virtual method is called, it uses the offset of the method in the
table(s). So, the ordering has to be consistent.

In this case, irrespective of the order of methods in the derived,
the table will be built using the order in base. 

In the example you have given,

Base VTable will have the following order:
ptr to A::~A()
ptr to A::doSomthing()
ptr to A::trySomthing();

Derived VTable will have the following order:
ptr to B::~B()
ptr to B::doSomthing()
ptr to B::trySomthing();
ptr to B::GetValue();
ptr to B::DropValue();
ptr to B::buba();

From uhcosc1320-return-529-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:38:08 2003
Return-Path: <uhcosc1320-return-529-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76Bc85Z1226902
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:38:08 -0500 (CDT)
Received: (qmail 28094 invoked by uid 108); 6 Aug 2003 11:43:19 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4763 invoked from network); 6 Aug 2003 11:07:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061102.h76B244t1115418@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:02:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Message from the department
Status: O
X-UID: 524
Content-Length: 634
X-Keywords: $NotJunk                                                                                           

-----Original Message-----
From: Jackson, Marshae L [mailto:MLJackso@Central.UH.EDU] 
Sent: Tuesday, August 05, 2003 4:40 PM

Hello, 
...
P.S. Please remind your students that they may sign up to be on the
Undergraduate COSC mailing list to receive important updates, etc. 
-CS website
-click on "mailing lists"
-subscribe to UNDERGRAD list

Thanks!

Marshae


Marshae L. Jackson   
Undergraduate Academic Advisor   
Dept. of Computer Science   
University of Houston
Student Consultation Hours:     MWF 8:30-11:30am   and    T TH 2-4pm    
T: (713) 743-3365           F: (713) 743-3335	     
Mail code: COSC 3010, PGH bldg, room 501

From uhcosc1320-return-530-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:39:02 2003
Return-Path: <uhcosc1320-return-530-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76Bd25Z1228572
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:39:02 -0500 (CDT)
Received: (qmail 28957 invoked by uid 108); 6 Aug 2003 11:44:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9238 invoked from network); 6 Aug 2003 11:14:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061109.h76B9RLf1137337@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:09:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Mterm3 (fwd)
Status: O
X-UID: 525
Content-Length: 1804
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>
>       I did a question in Mid Term3 can u check to see if it's right
>
>Thank u very much
>
>#include <iostream>
>using namespace std;
> 
>class Base {
>public: 
>        ~virtual Base() {}
>        virtual void f1()
>        {
>               f2();   //  dynamic
>               f3();   //     static
>               f4();   //     static
>        }
>        virtual void f2() { cout << "Base::f2" << endl; }
>        void f3() { cout << "Base::f3" << endl; }
>        static void f4() { cout << "Base::f4" << endl; }
>};
>class Derived : public Base {
>public:
>        virtual void h1() { cout << "Derived::h1" << endl; }
>        virtual void f1()
>        {
>               Base::f1(); //  static
>               f4(); //         static
>        }
>        void f3() { cout << "Derived::f3" << endl; }
>        static void f4() { cout << "Derived::f4" << endl; }
>};
>void foo(Base& b)                    
>{
>        b.f1(); // dynamic // not sure because you get the object by 
>reference of a different
>                               type but it can i think it's static because of 
>the first rule of the                              litmus you calling a 
>method on a object. Can you please clarify

You are not calling method on object. You are calling it on reference above.

>        b.f2(); // static

Above should be dynamic based on litmus test.

>        b.f3(); // static
>        b.f4(); // static
>}
>void main()
>{
>        Derived d; //     static //creating object 
>        d.f1(); //      static  //1 st rule of litmustest
>        d.f2(); //      static  //1 st rule of litmustest
>        d.f3(); //      static  //1 st rule of litmustest
>        d.f4(); //      static  //1 st rule of litmustest
>        foo(d); //      static  //call to a global function
>}

From uhcosc1320-return-531-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:39:30 2003
Return-Path: <uhcosc1320-return-531-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76BdU5Z1232013
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:39:30 -0500 (CDT)
Received: (qmail 29412 invoked by uid 108); 6 Aug 2003 11:44:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32640 invoked from network); 6 Aug 2003 11:00:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061055.h76AtAPI1530274@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 05:55:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Quest1,MidTerm2003 (fwd)
Status: O
X-UID: 526
Content-Length: 1046
X-Keywords: $NotJunk                                                                                           

>Hi
> 
>I have a question about a midTerm 2 problem.
> 
>In the very first question of our (2003) mid term,shouln't we have a unidirectional arrow
>going from computer class to printer class bcoz we can reach from computer to its
>printer(computer has a pointer to printer) but cannot go from a printer to its computer
>bcoz printer class doesn't have any pointer to computer.

I agree, except it is printers instead if printer. So, there should be
an arrow and a * at the printer end of the line.

>And what is the relationship btw the two.
>my answer was aggregation by reference,and hence a plain diamond.

Yes, again, there should be an arrow and *.

>Thanks
>And congratulations,this course has been like travelling in a spaceship(never travelled in one ,but I can at least imgine ),its been exciting, fast, sometimes exhausting but we explored and learnt a lot. 

Thanks, Explorer.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-532-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 06:44:16 2003
Return-Path: <uhcosc1320-return-532-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76BiG5Z1243367
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 06:44:16 -0500 (CDT)
Received: (qmail 32459 invoked by uid 108); 6 Aug 2003 11:49:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12217 invoked from network); 6 Aug 2003 11:19:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061114.h76BEIoq1135682@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:14:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] moday's lecture (fwd)
Status: O
X-UID: 527
Content-Length: 2140
X-Keywords: $NotJunk                                                                                           

>>From mondays example
>
>#include <iostream>
>using namespace std;
>
>class A
>{
>public:
>	virtual void f1(int a)
>	{
>		cout << "A::f1(int a)" << endl;
>	}
>
>	virtual const A& operator=(const A& other)
>	{
>		// Intentionally not implementing this method correct.
>		// Not the intent. We are trying to see how the
>		// methods are called.
>		cout << "called operator= of A" << endl;
>		return *this;
>	}
>};
>
>class B : public A
>{
>public:
>	// Comment out this f1 and try running.
>	virtual void f1(int a)
>	{
>		cout << "B::f1(int a)" << endl;
>	}
>
>	virtual void f1(double a)
>	{
>		cout << "B::f1(double a)" << endl;
>	}
>
>	// If you do not write an operator= here,
>	// the compiler write one.
>	//const B& operator=(const B& other);
>
>	// Now we will implement one here.
>	const B& operator=(const B& other)
>	{
>		// Intentionally not implementing this method correct.
>		// Not the intent. We are trying to see how the
>		// methods are called.
>		cout << "called operator= of B" << endl;
>
>		A::operator=(other);
>		return *this;
>	}
>
>	const A& operator=(const A& other)
>	{
>			const B* pOther = dynamic_cast<const B*> (&other);
>
>			if (pOther != 0)
>			{
>				return B::operator =(*pOther);
>			}
>			else
>				throw 0;
>	}
>};
>
>void main()
>{
>	B obj;
>	obj.f1(2.0);
>
>	A& ref = obj;
>	ref.f1(2);
>
>	B obj2;
>	A& ref2 = obj2;
>
>	obj = obj2; // obj.operator=(obj2); Static binding
>	ref = ref2; // ref.operator=(obj2); Dynamic binding
>// WHY IS THE ABOVE CODE DYNAMIC BINDING??????

Litmus test. 
Is the method operator= being called on an object?
No, it is being called on a reference ref.  
Is the method operator= marked virtual in the class of the type of
the reference (which is A here). Yes.

>	ref = obj2;  // WHAT TYPE OF BINDING IS THIS, AND WHY???

Same reasoning and same answer as above.

>	// A& tempRef = obj2;
>	//ref.operator =(tempRef);
>
>	try
>	{
>	A objA;
>	ref = objA;
>	}
>	catch(...)
>	{
>		cout << "aaahhh" << endl;
>	}
>}
>

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-533-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 09:55:36 2003
Return-Path: <uhcosc1320-return-533-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76EtZ5Z1303757
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 09:55:36 -0500 (CDT)
Received: (qmail 18797 invoked by uid 108); 6 Aug 2003 15:00:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16534 invoked from network); 6 Aug 2003 11:26:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061121.h76BL7xv1166187@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 06:21:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] 6318 Prerequisites (fwd)
Status: O
X-UID: 528
Content-Length: 959
X-Keywords: $NotJunk                                                                                           

>So you don't have to be a grad student to take the 6318 class?

No. But if you are an undergrad student, you need to petition 
for an elective. I also suggest that you wait until you take
a couple of programming courses before you take 6318 (wait until
you get to Sophomore year).

Venkat

>
>----- Original Message -----
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>To: "COSC 1320 Mailing List" <uhcosc1320@agiledeveloper.com>
>Sent: Monday, August 04, 2003 9:11 PM
>Subject: Re: [uhcosc1320] Data Structures (fwd)
>
>
>> >Very enticing, what are the prerequisites for course 6318?
>>
>> 1320 and Data Structures!
>>
>> Venkat Subramaniam
>> --
>> cosc155g@bayou.uh.edu Department of Computer Science
>> http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx
>77204-3475
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-534-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 10:00:11 2003
Return-Path: <uhcosc1320-return-534-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76F0A5Z1309598
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 10:00:10 -0500 (CDT)
Received: (qmail 23516 invoked by uid 108); 6 Aug 2003 15:05:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19803 invoked from network); 6 Aug 2003 15:01:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061456.h76EuM6H1295579@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 09:56:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Test 3 on Friday (fwd)
Status: O
X-UID: 529
Content-Length: 848
X-Keywords: $NotJunk                                                                                           

>I thought you said, "It will be from 5-7PM Friday (August 8th)."
>so, 5-7 or 6-8???

Initially I had said 5-7. However, in class some one said it is
hard to get from work by 5PM so, wanted it to be 6-8PM. So, we
decided in class that it will be 6-8PM instead.

Venkat

>
>
>>>Venkat, I have a couple of questions about the test on Friday.  
>>>First off, what all is going to be covered on there?  Is it going 
>>>to be a cumulative test of everything, or just the topics since 
>>>test 2?  
>>
>>Inheritance and Polymorphism.
>>
>>>Also, when is the test supposed to be, and when is it 
>>>going to be?  Just curious.  Thanks 
>>
>>It will be from 6-8PM Friday (August 8th).
>>
>>Venkat Subramaniam
>>--				
>>cosc155g@bayou.uh.edu		Department of Computer Science
>>http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475
>>

From uhcosc1320-return-535-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 10:02:40 2003
Return-Path: <uhcosc1320-return-535-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h76F2d5Z1329659
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 10:02:39 -0500 (CDT)
Received: (qmail 25770 invoked by uid 108); 6 Aug 2003 15:07:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18545 invoked from network); 6 Aug 2003 15:00:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308061455.h76Et9dB1300942@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 09:55:09 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Midterm 3 at 5PM or 6PM on Friday? (fwd)
Status: O
X-UID: 530
Content-Length: 1329
X-Keywords: $NotJunk                                                                                           

>Venkat,
>According to the University final exam schedule at
>http://www.uh.edu/enroll/rar/final_exam_schedule.html#summer
>our final exam should be on Friday from 5 to 8PM.  I suppose that if our
>test does not require 3 hours to complete, then that is why it is being
>given at 6PM.

Yes, we do not need three hours so we will go from 6-8PM.

Venkat

>
>----- Original Message -----
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>To: "COSC 1320 Mailing List" <uhcosc1320@agiledeveloper.com>
>Sent: Wednesday, August 06, 2003 5:56 AM
>Subject: [uhcosc1320] Test 3 on Friday (fwd)
>
>
>> >Venkat, I have a couple of questions about the test on Friday.
>> >First off, what all is going to be covered on there?  Is it going
>> >to be a cumulative test of everything, or just the topics since
>> >test 2?
>>
>> Inheritance and Polymorphism.
>>
>> >Also, when is the test supposed to be, and when is it
>> >going to be?  Just curious.  Thanks
>>
>> It will be from 6-8PM Friday (August 8th).
>>
>> Venkat Subramaniam
>> --
>> cosc155g@bayou.uh.edu Department of Computer Science
>> http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx
>77204-3475
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-536-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:29:35 2003
Return-Path: <uhcosc1320-return-536-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773TZ5Z1500685
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:29:35 -0500 (CDT)
Received: (qmail 26785 invoked by uid 108); 7 Aug 2003 03:34:54 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19691 invoked from network); 7 Aug 2003 03:23:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070318.h773IHc91468335@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:18:16 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] VTABLE question (fwd)
Status: O
X-UID: 531
Content-Length: 844
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>- I have a question about vtable. Does the destructor should be the first function in vtable.
> 

For the sake of this homework, follow the function ordering in the
base class.

>- Another question:
>Assume we have class like this:
> 
>class A 
>{
>        ~A();
>        virtual void b();
>        virtual void c();
>};
> 
>class B
>{
>       virtual void b();
>       virtual void d();
>       ~B();
>};
> 
> 
>Then the vtable of a will be
>~A
>b
>c
> 
>and of b
>b
>c
>d
>~B
> 
>or 
>~B
>b
>c
>d

Both of them are wrong for the given code. Since the destructor
of A is not virtual, the address of destructor will not appear in the
vtable. If, however, ~A was virtual, then the second option given
above for B will be correct.

> 
>Will the order of destructor of B  be the order of destructor of A?

Yes.

> 
>Thanks
> 

Venkat

From uhcosc1320-return-537-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:30:04 2003
Return-Path: <uhcosc1320-return-537-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773U35Z1477410
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:30:03 -0500 (CDT)
Received: (qmail 27236 invoked by uid 108); 7 Aug 2003 03:35:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22661 invoked from network); 7 Aug 2003 03:28:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070322.h773Mr9Y1450562@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:22:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] SB + DB at one step (fwd)
Status: O
X-UID: 532
Content-Length: 2526
X-Keywords: $NotJunk                                                                                           

>Hello
> 
>In the program discussed in following mail, in last step
> 
>foo(d);
>its said to be static binding.
>Why is it so??

The concept of polymorphism does not apply to global function.


>Even if foo is a global function,many decisions inside it(like which class to go to) have
>to be taken at run time, as it is taking a 'ref' in argument.

These have to do with binding of calls within foo then. Not related to
the call to foo itself.

>Could you please explain what happens inside foo at compile time and run time.
>Shdn't we say it is Static Bindng + Dynamic Binding at this step.  

No, it is either static binding or dynamic binding. A method may be
called from different places. It may be static at some, dynamic at
others (I am not refering to global methods in this case of course).
What is happening inside the method can not possibly decide the binding
at the place of call.

> 
>And will it be binding to four different functions at this (i.e foo(d))one single step?
> 
>"Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU> wrote:
>>Hi Venkat
>>
>> I did a question in Mid Term3 can u check to see if it's right
>>
>>Thank u very much
>>
>>#include 
>>using namespace std;
>> 
>>class Base {
>>public: 
>> ~virtual Base() {}
>> virtual void f1()
>> {
>> f2(); // dynamic
>> f3(); // static
>> f4(); // static
>> }
>> virtual void f2() { cout << "Base::f2" << endl; }
>> void f3() { cout << "Base::f3" << endl; }
>> static void f4() { cout << "Base::f4" << endl; }
>>};
>>class Derived : public Base {
>>public:
>> virtual void h1() { cout << "Derived::h1" << endl; }
>> virtual void f1()
>> {
>> Base::f1(); // static
>> f4(); // static
>> }
>> void f3() { cout << "Derived::f3" << endl; }
>> static void f4() { cout << "Derived::f4" << endl; }
>>};
>>void foo(Base& b) 
>>{
>> b.f1(); // dynamic // not sure because you get the object by 
>>reference of a different
>> type but it can i think it's static because of 
>>the first rule of the litmus you calling a 
>>method on a object. Can you please clarify
>
>You are not calling method on object. You are calling it on reference above.
>
>> b.f2(); // static
>
>Above should be dynamic based on litmus test.
>
>> b.f3(); // static
>> b.f4(); // static
>>}
>>void main()
>>{
>> Derived d; // static //creating object 
>> d.f1(); // static //1 st rule of litmustest
>> d.f2(); // static //1 st rule of litmustest
>> d.f3(); // static //1 st rule of litmustest
>> d.f4(); // static //1 st rule of litmustest
>> foo(d); // static //call to a global function
>>}

From uhcosc1320-return-538-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:30:36 2003
Return-Path: <uhcosc1320-return-538-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773UZ5Z1473757
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:30:36 -0500 (CDT)
Received: (qmail 27701 invoked by uid 108); 7 Aug 2003 03:35:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20404 invoked from network); 7 Aug 2003 03:24:56 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070319.h773JUjc1397483@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:19:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] immutable object (fwd)
Status: O
X-UID: 533
Content-Length: 324
X-Keywords: $NotJunk                                                                                           

>Can you explain what immutable objects are?  THanks.

Please refer to past emails at 
http://www.cs.uh.edu/~svenkat/summer2003/mailstoclass
and look for immutable.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-538-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:30:36 2003
Return-Path: <uhcosc1320-return-538-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773UZ5Z1473757
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:30:36 -0500 (CDT)
Received: (qmail 27701 invoked by uid 108); 7 Aug 2003 03:35:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20404 invoked from network); 7 Aug 2003 03:24:56 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070319.h773JUjc1397483@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:19:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] immutable object (fwd)
Status: O
X-UID: 534
Content-Length: 324
X-Keywords: $NotJunk                                                                                           

>Can you explain what immutable objects are?  THanks.

Please refer to past emails at 
http://www.cs.uh.edu/~svenkat/summer2003/mailstoclass
and look for immutable.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-539-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:33:42 2003
Return-Path: <uhcosc1320-return-539-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773Xe5Z1501402
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:33:42 -0500 (CDT)
Received: (qmail 29749 invoked by uid 108); 7 Aug 2003 03:38:55 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23502 invoked from network); 7 Aug 2003 03:29:40 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070324.h773OE7E1486112@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:24:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] old exam prob. (fwd)
Status: O
X-UID: 535
Content-Length: 976
X-Keywords: $NotJunk                                                                                           

>>From the following:
>
>class FileManager
>
>{
>
>public:
>
>                virtual void copyFile(String sourceFileName, String targetFileName);
>
>                                // Throws: throws FileNotFound Exception
>
>...
>
>};
>
> 
>
>class RemoteFileManager : public FileManager
>
>{
>
>public:
>
>                virtual void copyFile(String sourceFileName, String targetFileName);
>
>                                // Throws: throws FileNotFound Exception and NetworkConnection Exception
>
>...
>
>};
>
> 
>
>        Are any principles being violated? If so, what? Explain why there may be a problem.
>
>
>There isn't any principle being violated, correct, since the method is not being hidden?  Thanks.
>

Here is the next bonus question!

Any takers. I will forward the first correct response received.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-540-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:41:34 2003
Return-Path: <uhcosc1320-return-540-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773fY5Z1540447
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:41:34 -0500 (CDT)
Received: (qmail 2428 invoked by uid 108); 7 Aug 2003 03:46:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28179 invoked from network); 7 Aug 2003 03:36:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070330.h773Un381481490@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:30:49 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] another midterm3 ? (fwd)
Status: O
X-UID: 536
Content-Length: 1598
X-Keywords: $NotJunk                                                                                           

>When we create an object of a derived class, does the constructor of the base class get called prior to the constructor of the derived class?  Is that the reason for the following output for the following code:

Yep.

>
>#include <iostream.h>
>
>class X {
>protected:
>	void fn() { cout << "In X::fn()\n"; } 			// A
>public:
>	X() { cout << "In X::X()\n"; }   				// B
>	virtual void print() { cout << "In X::print()\n"; fn(); }	// C
>	virtual void fnx() { cout << "In X::fnx()\n"; }
>};
>
>class Y : public X {  // Inheritance of Y from X
>public:
>	Y() { cout << "In Y::Y()\n"; }				// D
>	virtual void print() { cout << "In Y::print()\n"; fn(); }	// E
>	virtual void fny() { cout << "In Y::fny()\n"; }
>};
>
>class Z : public Y {  // Inheritance of Z from Y
>public:
>	Z() { cout << "In Z::Z()\n"; }				// F
>	virtual void print() { cout << "In Z::print()\n"; fn(); }	// G
>};
>
>void foo1(X& obj) { obj.print(); }		// H		Output:
>
>void foo2(Y& obj) { obj.print(); }		// I
>
>void foo3(Z& obj) { obj.print(); }		// J
>
>void foo4(X obj) { obj.print(); }			// K
>
>void main()
>{
> X objx;					// L
> Y objy;					// M
> Z objz;						// N
>
> foo1(objx);					// O
> foo4(objx);					// P
>
> foo2(objy);					//Q 
> foo4(objy);					// R
>
> foo3(objz);					// S
> foo4(objz);					// T
>}
>  when the objects of class X, Y, and Z are called, the output starts off with:
>In X::X()
>In X::X()
>In Y::Y()
>In X::X()
>In Y::Y()
>In Z::Z()
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-541-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:43:24 2003
Return-Path: <uhcosc1320-return-541-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773hN5Z1524894
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:43:24 -0500 (CDT)
Received: (qmail 3759 invoked by uid 108); 7 Aug 2003 03:48:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27418 invoked from network); 7 Aug 2003 03:35:23 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070329.h773Tv4F1490112@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:29:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] midterm3 ? (fwd)
Status: O
X-UID: 537
Content-Length: 1085
X-Keywords: $NotJunk                                                                                           

>Can you see if the following is correct.  If there is something incorrect, can you please advise why it should be othwise.  Thanks.
>
>#include <iostream.h>
>class X {
>public:
>	virtual void f1()
>	{
>		cout << "In X::f1()" << endl;
>	}
>	void f2()
>	{
>		f1();						_______DYNAMIC__________
>		cout << "In X::f2()" << endl;
>	}
>};
>void function(X& obj)
>{
>	obj.f1();						________DYNAMIC_________
>	obj.f2();						______STATIC___________
>}
>void main()
>{
>	X obj;
>
>	obj.f1();						______STATIC___________
>	obj.f2();						_______DYNAMIC__________ 


WHY?

>
>	function(obj); 						_______DYNAMIC__________ // NOT SURE WHY THOUGH?  PLEASE EXPLAIN

This is call to global function. Static.

>	X* ptr = &obj; 						_______STATIC__________

Nothing is being called here. You can leave it as static or cancel this one.

>
>	ptr->f1();						______DYNAMIC___________
>	ptr->f2();						_______STATIC__________
>}
>

Not bad.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-542-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:44:19 2003
Return-Path: <uhcosc1320-return-542-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773iJ5Z1538468
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:44:19 -0500 (CDT)
Received: (qmail 4359 invoked by uid 108); 7 Aug 2003 03:49:39 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25300 invoked from network); 7 Aug 2003 03:32:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070327.h773R7Dl1470205@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:27:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] MidTerm3 2001 (fwd)
Status: O
X-UID: 538
Content-Length: 2486
X-Keywords: $NotJunk                                                                                           

>Hi venkat
>
>       i feel so bad for with my self. I made one small stupid mistake in the 
>program and it cost me 25pts.:(
>
>Any way i did this program on the midterm 3 of 2003 is this what you'er 
>looking for as a answer if not can u explain what else i need to add.
>
>#include <iostream>
>
>using namespace std;
>class Modem 
>{
> public:
>
>                Modem() {}
>
>                //function wrote for just checking when running. According 
>the question 
>                // u don't need this right.
>                virtual void info()
>                {
>                    printf("This is a Modem %p\n", this);
>                }
>                virtual Modem* createModem()const
>                {
>                    return new Modem(*this);
>                }
> protected:
>     Modem(const Modem& other) {}
>
>};
>
>class ModemVendor1 : public Modem 
>{
> public:
>
>                ModemVendor1() {}
>
>                 //function wrote for just checking when running. According 
>the question 
>            // u don't need this right. 
>                virtual void info()
>                {
>                    printf("This is a ModemVendor1 %p\n", this);
>                }
>                virtual Modem* createModem()const
>                {
>                    return new ModemVendor1(*this);
>                }
> protected:
>     ModemVendor1(const ModemVendor1& other) {}
>};
>
>class Computer 
>{
> public:
>                Computer(Modem* pModem)
>                {
>                    m_pModem = pModem; 
>                }
>
>                Computer(const Computer& other)
>                {
>                    m_pModem = other.m_pModem->createModem();
>
>                } 
>                void info()
>                {
>                    m_pModem->info();
>                }
>
> private:
>                Modem* m_pModem;        
>};

Except for the fact that you are not following law of big three in
the Car class, it looks fine otherwise.

>/* Test Code
>void main()
>{
>    Computer c1(new ModemVendor1());
>    Computer c2 = c1;
>    c1.info();
>    c2.info();
>}
>*/
>
>I had to switch the class Computer from the place it was because it would 
>give me a error because the modem pointer is not created until class of modem 
>have compiled so is this part of the question or it's just the way it's printed 
>on the paper for convienience
>Let me know 
>thank you so much

This problem is not the focus of this question.

Venkat


From uhcosc1320-return-543-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:45:18 2003
Return-Path: <uhcosc1320-return-543-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773jI5Z1538516
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:45:18 -0500 (CDT)
Received: (qmail 5151 invoked by uid 108); 7 Aug 2003 03:50:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3439 invoked from network); 7 Aug 2003 03:48:18 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070342.h773gp1V1487399@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:42:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Clarifying Binding and Hiding (fwd)
Status: O
X-UID: 539
Content-Length: 4995
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Could you please take a look at the example from class and see if the comments I added are correct.  I have included the reasons I believe them to be correct at the end of the code.
>
>#include <iostream>
>using namespace std;
>
>class Base
>{
>public:
>	virtual void f1() { cout << "Base::f1" << endl; }
>	void f2() { cout << "Base::f2" << endl; }
>	virtual void f3(int a)
>	{
>		cout << "Base::f3" << endl;
>	}
>};
>
>class Derived : public Base
>{
>public:
>	virtual void f1() { cout << "Derived::f1" << endl; }
>	void f2() { cout << "Derived::f2" << endl; }
>	virtual void f3(double a)
>	{
>		cout << "Derived::f3" << endl;
>	}
>};
>
>void main()
>{
>	Derived obj;
>	Base* ptr = &obj;
>
>	obj.f1();  //Static Derived::f1
>	obj.f2();  //Static Derived::f2
>	obj.f3(2); //Static Derived::f3
>	cout << "----------" << endl;
>	ptr->f1();  //Dynamic
>	ptr->f2();  //Static Base::f2
>	ptr->f3(2); //Dynamic
>
>}
>
>The first three static are static because they are called on "true" objects not pointers or references, correct?
>
>The first dynamic is dynamic because ptr is a pointer to a Base type and in the Base class f1 is virtual, correct?
>
>The next static is static because ptr is a pointer to a Base type and in the Base class f2 is not virtual, correct?
>
>The second dynamic is dynamic for same reason the first dynamic is dynamic, correct?  Even though the signature is different in the base and derived (i.e. Hiding)
>

Excellent!!!!!!! Hats off! Congratulations++ 

>The vtable diagram for this example would be:
>VTABLE OF BASE
>Base::f1
>Base::f3(int a)
>
>VTABLE OF DERIVED
>Derived::f1
>Derived::f3(int a)
>Derived::f3(double a)
>
>Now lets say I add a Class Derived2.. The new code looks like this:
>
>#include <iostream>
>using namespace std;
>
>class Base
>{
>public:
>	virtual void f1() { cout << "Base::f1" << endl; }
>	void f2() { cout << "Base::f2" << endl; }
>	virtual void f3(int a)
>	{
>		cout << "Base::f3" << endl;
>	}
>};
>
>class Derived : public Base
>{
>public:
>	virtual void f1() { cout << "Derived::f1" << endl; }
>	void f2() { cout << "Derived::f2" << endl; }
>	virtual void f3(double a)
>	{
>		cout << "Derived::f3" << endl;
>	}
>};
>
>class Derived2:public Derived
>{
>public:
>	virtual void f1() { cout << "Derived2::f1"<< endl;}
>	void f2() { cout << "Derived2::f2" << endl; }
>	virtual void f3(double a)
>	{
>		cout << "Derived2::f3" << endl;
>	}
>};
>
>void main()
>{
>	Derived obj;
>	Derived2 other;
>	Base* ptr = &obj;
>	Derived* dptr = &other;
>	Base* bptr = &other;
>
>	obj.f1();  //Static Derived::f1
>	obj.f2();  //Static Derived::f2
>	obj.f3(2); //Static Derived::f3
>	cout << "----------" << endl;
>	ptr->f1();  //Dynamic
>	ptr->f2();  //Static Base::f2
>	ptr->f3(2); //Dynamic
>	cout <<"--------------"<<endl;
>	dptr->f1();  //Dynamic
>	dptr->f2();  //Static Derived::f2
>	dptr->f3(3.5);  //Dynamic
>	cout <<"------------------"<<endl;
>	bptr->f1();  //Dynamic
>	bptr->f2();  //Static Base::f2
>	bptr->f3(3.5);  //Dynamic
>}

Wonderful.

>
>In the second block of pointers calling the functions I have a pointer to the first derived class.  Derived2 Inherits from Derived not Base (directly).
>
>The first dynamic is dynamic because dptr is a pointer to a Derived type and in the Derived class f1 is virtual, correct?
>
>The next static is static because ptr is a pointer to a Derived type and in the Derived class f2 is not virtual, correct?
>
>The second dynamic is dynamic for same reason the first dynamic is dynamic, correct?  
>
>Now in the third block of pointers calling the functions I have a pointer to base class.  The object is really a Derived2 object which does not inherit from Base directly.  This code ran and produced output that I thought it should.  Let me know if I have messed up the logic of Binding or Inheritance.
>
>The first dynamic is dynamic because bptr is a pointer to a Base type and in the Base class f1 is virtual, correct?
>
>The next static is static because bptr is a pointer to a Base type and in the Base class f2 is not virtual, correct?
>
>The second dynamic is dynamic for same reason the first dynamic is dynamic, correct?  Even though the signature is different in the base and derived2 (i.e. Hiding)
>
>The vtable chart for this new code is:
>VTABLE OF BASE
>Base::f1
>Base::f3(int a)
>
>VTABLE OF DERIVED
>Derived::f1
>Derived::f3(int a)
>Derived::f3(double a)
>
>VTABLE OF DERIVED2
>Derived2::f1
>Derived2::f3(int a)  // Do I really have this in the Vtable Because I did not Inherit it directly from Base.  I am thinking that I should have it there because as I Inherit from Derived I am getting Base for free.  Because of the Memory piggy backing that Inheriting does.
>Derived2::f3(double a)
>

You are unbeatable on this one. What ever you have done, just do it
in the exam and you will come out with flying colors. Great.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-544-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:45:38 2003
Return-Path: <uhcosc1320-return-544-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773jZ5Z1540215
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:45:36 -0500 (CDT)
Received: (qmail 5492 invoked by uid 108); 7 Aug 2003 03:50:55 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31528 invoked from network); 7 Aug 2003 03:41:16 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070335.h773Zo491518313@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:35:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] COSC 1320 assignment#3 question (fwd)
Status: O
X-UID: 540
Content-Length: 520
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>    I was hoping you could look at my assignment#3 modified and let me know 
>if it is possible to receive any extra points.
>
>The changes were... <snip><snip><snip>

A gentle reminder and for your convenience the following excerpt from
http://www.cs.uh.edu/~svenkat/summer2003/grades.html
is shown below:

"If you have questions about assignments or Midterms, please
talk to Venkat. 

Do not send any emails to Venkat about grading issues. Talk to him before or aft
er the class instead"

Thanks

Venkat

From uhcosc1320-return-545-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:50:12 2003
Return-Path: <uhcosc1320-return-545-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773oC5Z1556315
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:50:12 -0500 (CDT)
Received: (qmail 8631 invoked by uid 108); 7 Aug 2003 03:55:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7110 invoked from network); 7 Aug 2003 03:53:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070347.h773lmJZ1559582@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:47:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] 2001mid3#1 (fwd)
Status: O
X-UID: 541
Content-Length: 1446
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>
>Would you please help me check my answer whether they are correct for 2001 
>mid3 #1:
>Summer 2001 Midterm 3 August 8, 2001
>Name                                Student Number:
>1.  1.       Write static or dynamic to indicate if each call will go through 
>static binding or dynamic binding [10 pts].
>class A { public:
>    virtual void f1() {}
>    void f2()
>    {
>        f1();  // _____static___

This should be dynamic. You are calling f1 here using the "this" pointer.

>    }
>    static void f3(A& obj)
>    {
>        obj.f1(); // _____dynamic_________
>        obj.f2(); // _____static_________
>    }
>};
> 
>class B : public A {
>public:
>    virtual void f4()
>    {
>        f1();  // ___dynamic___________
>        f3(*this);  // ___static___________
>    }
>    static void f3(A& obj)
>    {
>        obj.f1();  // ___dynamic___________
>    }
>};
> 
>void f(A& objA)
>{
>    objA.f1(); // ___dynamic___________
>    objA.f2(); // ___static___________
>    objA.f3(objA); // ___static___________
>}
> 
>void main()
>{
>    A objA; 
>    B objB; 
> 
>    objA.f1(); // ___static___________
>    objA.f2(); // ___ static ___________
>    objA.f3(objA); // ___ static ___________
>    objB.f1(); // ___ static ___________
>    objB.f2(); // ___ static ___________
>    objB.f3(objB); // ___ static ___________
> 
>    f(objA); 
>    f(objB); 
>}
>
>Thank you very much for your help.

You are most welcome.

Venkat

From uhcosc1320-return-546-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 22:54:53 2003
Return-Path: <uhcosc1320-return-546-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h773sr5Z1051281
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 22:54:53 -0500 (CDT)
Received: (qmail 11545 invoked by uid 108); 7 Aug 2003 04:00:07 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5654 invoked from network); 7 Aug 2003 03:50:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070345.h773jWgf1553631@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:45:32 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Overwriting non-virtual static methods (fwd)
Status: O
X-UID: 542
Content-Length: 1153
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>You said we should not overwrite methods that are not virtual in the base 
>class. Does the same thing apply to static methods as well?

Static methods are never overridable. They are never called on objects.
It is a bad calling convention to call static methods using objects like
obj.AStaticMethod(). When the compiler see this, it will replace it with
ClassName::AStaticMethod(); The behavior of these are similar in nature
to global methods as far as binding.

>Because in this example,
>
>class Base
>{
>
>public:
>
>virtual void f1()
>{
>  f2()
>}
>
>static void f2() {}
>
>};
>
>class Derived: public Base
>{
>
>static void f2() {}
>
>};
>
>
>void main()
>{
>Derived d;
>d.f1();
>d.f2();
>}
>
>In the first function call the f2() of Base is called (through f1) and in 
>the second the f2() of Derived is called although you are calling both on 
>the derived object. Because this behavior is inconsistent I would say the 
>rule applies to static methods as well.
>
>Thanks,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-547-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:04:11 2003
Return-Path: <uhcosc1320-return-547-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h7744A5Z1084654
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:04:10 -0500 (CDT)
Received: (qmail 17683 invoked by uid 108); 7 Aug 2003 04:09:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11286 invoked from network); 7 Aug 2003 03:59:42 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070354.h773sFDO1050882@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:54:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] static/dynamic (fwd)
Status: O
X-UID: 543
Content-Length: 2190
X-Keywords: $NotJunk                                                                                           

>Will you please check that I have the correct answers to the follow question.  Thanks.
>
>Mention Static or Dynamic for each call in the blank lines provided.
>#include <iostream.h>
>class Vehicle { public:
>	virtual void startUp()	{ 
>		cout << "In Vehicle::startUp()\n";
>		checkEngine();					//_______DYNAMIC_________
>		checkFuelLevel();					//_______STATIC_________
>		start();							//_______DYNAMIC_________
>	}
>	virtual void checkEngine() { cout << "In Vehicle::checkEngine()\n"; }
>	void checkFuelLevel() { cout << "In Vehicle::checkFuelLevel\n"; }
>	virtual void start() { cout << "In Vehicle::start()\n"; }
>};
>class Car : public Vehicle { public:
>	virtual void start() { cout << "In Car::start()\n"; }
>	virtual void checkFuelLevel() { cout << "In Car::checkFuelLevel()\n"; }
>	virtual void checkEngine() { cout << "In Car::checkEngine()\n"; }
>	virtual void RollWindow() { cout << "In Car::RollWindow()\n"; }
>};
>void TuneUp(Vehicle obj){
>	obj.checkEngine();						//_______STATIC_________
>}
>void Drive(Car& obj){
>	obj.checkEngine();						//_______DYNAMIC_________
>	obj.checkFuelLevel();						//_______DYNAMIC_________
>	obj.RollWindow();						//_______DYNAMIC_________
>	obj.start();							//_______DYNAMIC_________
>}
>void Inspect(Vehicle& obj){
>	obj.checkEngine();						//________DYNAMIC________
>	obj.checkFuelLevel();						//_______STATIC_________
>	obj.start();							//_______DYNAMIC_________
>}
>void main(){
>	Vehicle v1;	Car c1, c2;
>
>	v1.startUp();							//_______STATIC_________
>	c1.startUp();							//_______STATIC_________
>
>	TuneUp(v1);							//_______STATIC_________
>	TuneUp(c1);							//________STATIC________
>
>	Inspect(v1);							//_______STATIC_________
>
>	Inspect(c1);							//_______STATIC_________
>	Drive(c1);							//_______STATIC_________		}
>
>
>thanks again.

How wonderful? Is it me dreaming or is it that students are suddenly learning 
and sending all the correct responses. 

I only have one advice.  What ever you all are doing, just keep doing it.
You guys are great.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-548-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:15:26 2003
Return-Path: <uhcosc1320-return-548-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774FQ5Z1122301
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:15:26 -0500 (CDT)
Received: (qmail 24565 invoked by uid 108); 7 Aug 2003 04:20:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16466 invoked from network); 7 Aug 2003 04:07:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070402.h7742Aji1149088@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 23:02:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Virtual constructor example in class has memory leak??? (fwd)
Status: O
X-UID: 544
Content-Length: 1751
X-Keywords: $NotJunk                                                                                           

>Venkat,

First, thanks for such a wonderful subject line. You made my day.

>Doesn't this program have memory leak?  There are a bunch of "new"'s and no "delete"'s...
>
>Shouldn't there be a virtual ~Car( ) { delete[] pEngine;} in the car Class.  Wouldn't that take care of all the memory leaks?

Oh Absolutely, you are correct.. However, we are not writing a complete code 
for this one (and several other examples for that matter). The purpose was to 
illustrate the issues with object creation.

>
>#include <iostream>
>using namespace std;
>
>class Engine
>{
>public:
>	Engine() {}
>	virtual void info()
>	{
>		printf("This is Engine %p\n", this);
>	}
>	virtual ~Engine() {}
>
>	virtual Engine* createOneJustAsWonderfulAsYouAre() const
>	{
>		return new Engine(*this);
>	}
>protected:
>	Engine(const Engine& other) {}
>};
>
>class TurboEngine : public Engine
>{
>public:
>	virtual void info()
>	{
>		printf("This is a TurboEngine %p\n", this);
>	}
>	virtual Engine* createOneJustAsWonderfulAsYouAre() const
>	{
>		return new TurboEngine(*this);
>	}
>};
>
>class Car
>{
>public:
>	Car(Engine* p) 
>	{
>		pEngine = p;
>	}
>	Car(const Car& other)
>	{
>/*		if (dynamic_cast<TurboEngine*> (other.pEngine) != 0)
>		{
>			pEngine = new TurboEngine((TurboEngine&)(
>					*other.pEngine));
>		}
>		else
>		{
>			pEngine = new Engine(*other.pEngine);
>		}
>		*/
>
>		pEngine = other.pEngine->createOneJustAsWonderfulAsYouAre();
>	}
>	void info()
>	{
>		pEngine->info();
>	}
>private:
>	Engine* pEngine;
>};
>
>void main()
>{
>	Car c1(new Engine());
>
>	Car c2 = c1;
>
>	c1.info();
>	c2.info();
>}


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-549-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:19:06 2003
Return-Path: <uhcosc1320-return-549-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774J65Z1131265
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:19:06 -0500 (CDT)
Received: (qmail 26891 invoked by uid 108); 7 Aug 2003 04:24:26 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15076 invoked from network); 7 Aug 2003 04:05:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070359.h773xndx1072846@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 22:59:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Pointers in VTables... (fwd)
Status: O
X-UID: 545
Content-Length: 607
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>Do pointers and references created within main drawn on the VTable? Or is it just objects of a class that are drawn on the VTable?

Neither of them go on to the VTable. On the diagram, show only VTables
and how objects (not pointers or references) are related to it.

>Thanks for your time.
>
>P.S. My friends name is Venkat...j/k.

errrrrrrrrr. I have filed a motion at the court to change my name to 
NoOneYouKnow NotAUniqueName. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-550-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:20:29 2003
Return-Path: <uhcosc1320-return-550-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774KS5Z1499397
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:20:28 -0500 (CDT)
Received: (qmail 28038 invoked by uid 108); 7 Aug 2003 04:25:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25262 invoked from network); 7 Aug 2003 04:21:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070416.h774G7ZW1127286@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 23:16:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Doubt Regrading Static and Dynamic Binding (fwd)
Status: O
X-UID: 546
Content-Length: 5350
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> 
>In the code given below, i am getting confused with methods being called at compile time and run time.
> 
>#include <iostream>
>using namespace std;
>class A
>{
>public:
> virtual void f1(int a)
> {
>  cout << "A::f1(int a)" << endl;
> }
> virtual const A& operator=(const A& other)
> {
>  // Intentionally not implementing this method correct.
>  // Not the intent. We are trying to see how the
>  // methods are called.
>  cout << "called operator= of A" << endl;
>  return *this;
> }
>};
>class B : public A
>{
>public:
> // Comment out this f1 and try running.
> virtual void f1(int a)
> {
>  cout << "B::f1(int a)" << endl;
> }
> virtual void f1(double a)
> {
>  cout << "B::f1(double a)" << endl;
> }
> // If you do not write an operator= here,
> // the compiler write one.
> //const B& operator=(const B& other);
> // Now we will implement one here.
> const B& operator=(const B& other)
> {
>  // Intentionally not implementing this method correct.
>  // Not the intent. We are trying to see how the
>  // methods are called.
>  cout << "called operator= of B" << endl;
>  A::operator=(other);
>  return *this;
> }
> const A& operator=(const A& other)
> {
>   const B* pOther = dynamic_cast<const B*> (&other);
>   if (pOther != 0)
>   {
>    return B::operator =(*pOther);
>   }
>   else
>    throw 0;
> }
>};
>void main()
>{
> B obj;
> obj.f1(2.0);
> A& ref = obj;
> ref.f1(2);
> B obj2;
> A& ref2 = obj2;
> obj = obj2; // obj.operator=(obj2); Static binding
> ref = ref2; // ref.operator=(obj2); Dynamic binding
> ref = obj2;
> // A& tempRef = obj2;
> //ref.operator =(tempRef);
> try
> {
> A objA;
> ref = objA;
> }
> catch(...)
> {
>  cout << "aaahhh" << endl;
> }
>}
> 
> 
>I am confused with the following 3 lines of code:
> 
>obj = obj2; // obj.operator=(obj2); Static binding
> ref = ref2; // ref.operator=(obj2); Dynamic binding  ref = obj2;
>
>1. obj = obj2;
> 
>My understanding:
> 
>Compile Time:
> 
>Since the method 'operator=' is being called on an object(obj) compiler determines this as static binding at compile time.So at compile time, compiler enters the 'operator=' of class B and determines this as static binding.
> 
>Q---Then what does the compiler say here? //-----------------------------------Doubt
>Q---Here does compiler checks to see if the 'operator=' of  B  takes an argument(or  object) of type B, since the right operand obj2 is of type B?
>   //---------------------------------------------Doubt

It is static binding. If it can find an operator= in B that 
takes a reference to B, it will use it.

>Run Time:
> 
>At run time compiler goes to the class of type of real object(i.e. class B of real object obj2) and the code in 'operator=' is executed.Is that all what happens.
> 

Well at run time there is no compiler involved. The run time (the execution
process that is) will will call the methods that is statically bound.

>2. ref = ref2;
> 
>My understanding is:
> 
>Compile Time:
> 
>For this since the method 'operator=' is being called on reference, and since the method is virtual in the class of type of reference (i.e. class A), compiler determines this as 
>dynamic binding at compile time.And then it says,at run time,it will go to the class of type of what ref is pointing to(i.e. the  reference or pointer or object).
> 
>Q---Does the compiler determine what the argument the method should take at run time and if it is then how? // ----------------------------------Doubt

At compile time, it says alright this will be dynamic binding. 
But, the method name and signature are settled at compile time.
Looking at the type of reference (A) it decides to call operator=
which takes a reference to A. So, at run time, it will want an
operator= that takes a A reference only.

>Run Time:
> 
>Since, in this case, the right-side operand ref2 is reference of type A compiler goes to 'operator=' of class A at run time and asks if it has an 'operator=' which takes as an argument a reference of type A and if so the code is executed.
> 
>3. ref = obj2;
> 
> 
>My understanding is:
> 
>Compile Time:
> 
>For this since the method 'operator=' is being called on reference, and since the method is virtual in the class of type of reference (i.e. class A), compiler determines this as 
>dynamic binding at compile time.And then it says,at run time,it will go to the class of type of what ref is pointing to(i.e. the  reference or pointer or object).
> 

Same reasoning as above applies to this as well. At compile time, it
decides dynamic binding. But it has to decide the method name and
signature. So, it says, I will call at runtime a method operator=
which takes a reference to A. Why reference to A. That is all it
can find in A and it figures it can treat object of B (obj2) can be
treated as A.

So, it modifies

ref = obj2;

as 

A& tempRef = obj2;
ref = tempRef;

>Run Time:
> 
>Since, in this case, the right-side operand obj is object of B compiler goes to 'operator=' of class B at run time(due to polymorphism) and asks if it has an 'operator=' which takes as an argument an object of type B and if so the code is executed.IF NOT COMPILER GOES TO THE BASE CLASS (operator=) and executes that code.
> 

Same reasoning as above applies here again.

>Could you please clarify how much of this is right?
>I think i am unnecessarily confusing myself.
> 
>Thanks and Regards.


From uhcosc1320-return-551-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:25:10 2003
Return-Path: <uhcosc1320-return-551-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774PA5Z1144941
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:25:10 -0500 (CDT)
Received: (qmail 30940 invoked by uid 108); 7 Aug 2003 04:30:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29508 invoked from network); 7 Aug 2003 04:28:18 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070422.h774MqJx1144816@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 23:22:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] static/dynamic (fwd)
Status: O
X-UID: 547
Content-Length: 1763
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>In the below example, when you get to animal.eat  and snow.eat which eat() do you look at?  animal eat or cat eat?
>
>Also can you tell me if I am correct in saying static or dynamic?
>
>Thank You, 
>
>#include <iostream.h>
>class Animal {	public:
>	void eat() { 
>cout << "Animal Eats\n"; 
>makeNoise();	___static_________

The above has to be dynamic. It is called using the "this" pointer.

>}
>	virtual void makeNoise() { cout << "Animal makesNoice\n"; }
>};
>class Cat : public Animal { public:
>	virtual void eat() { cout << "Cat Eats\n"; } // Cat eat's quietly
>	virtual void sleepAllDay() { cout << "zzzzzzz scatch zzzzzz\n"; }
>};
>class Dog: public Animal { public:
>	void makeNoise() { cout << "Dog makesNoice\n";}
>	virtual void wagTheTail() { cout << "Wagwag\n"; };
>};
>      void playWithAnimal(Animal& animal)	{
>	animal.eat(); ___dynamic___________

Above fails litmus test. Should be static.

>	animal.makeNoise();  ____static_________

Above passes litmus test. Should be dynamic.

>      }
>      void playWithCat(Cat& aCat)	{
>	aCat.eat();	____static__________

Passes litmus test, should be dynamic.

>	aCat.sleepAllDay();	__static_______________

Passes litmus test, should be dynamic.

>      }
>      void main()	{
>	Cat snow
>	snow.eat();	_______static____________
>	snow.makeNoise();	___static_______________
>	playWithAnimal(snow);	______static_____________
>	playWithCat(snow);	________static___________
>	Dog spin;
>	spin.eat();	_______________static____
>	spin.makeNoise();	_____________static______
>	playWithAnimal(spin);	_______static_______
>      }
>
>

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-552-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:30:11 2003
Return-Path: <uhcosc1320-return-552-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774UA5Z1160317
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:30:10 -0500 (CDT)
Received: (qmail 1636 invoked by uid 108); 7 Aug 2003 04:35:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27412 invoked from network); 7 Aug 2003 04:24:56 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070419.h774JUwK1136339@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 23:19:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: FW: [uhcosc1320] 6318 Prerequisites (fwd)
Status: O
X-UID: 548
Content-Length: 1247
X-Keywords: $NotJunk                                                                                           

That is my understanding. However, do not take my word for any thing
related to administrative issues.

Venkat

>So, to clarify:
>
>If we complete the prerequisites and our petition is granted, we would be
>able to use 6318 as our advanced COSC elective?
>
>-----Original Message-----
>From: Dr. Venkat Subramaniam [mailto:cosc155g@Bayou.UH.EDU] 
>Sent: Wednesday, August 06, 2003 6:21 AM
>To: uhcosc1320@agiledeveloper.com
>
>>So you don't have to be a grad student to take the 6318 class?
>
>No. But if you are an undergrad student, you need to petition 
>for an elective. I also suggest that you wait until you take
>a couple of programming courses before you take 6318 (wait until
>you get to Sophomore year).
>
>Venkat
>
>>
>>----- Original Message -----
>>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>>To: "COSC 1320 Mailing List" <uhcosc1320@agiledeveloper.com>
>>Sent: Monday, August 04, 2003 9:11 PM
>>Subject: Re: [uhcosc1320] Data Structures (fwd)
>>
>>
>>> >Very enticing, what are the prerequisites for course 6318?
>>>
>>> 1320 and Data Structures!
>>>
>>> Venkat Subramaniam
>>> --
>>> cosc155g@bayou.uh.edu Department of Computer Science
>>> http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx
>>77204-3475

From uhcosc1320-return-553-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:33:02 2003
Return-Path: <uhcosc1320-return-553-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774X15Z1142122
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:33:01 -0500 (CDT)
Received: (qmail 3489 invoked by uid 108); 7 Aug 2003 04:38:16 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26510 invoked from network); 7 Aug 2003 04:23:49 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070418.h774INJZ1193914@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 23:18:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] RE: Vtable - Destructors (fwd)
Status: O
X-UID: 549
Content-Length: 685
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>You mentioned in class that the first four bytes of a class in a Vtable are
>assigned to the Destructor. Does this mean that the destructor will always
>be at the top of the list in the Vtable diagram? Or, as another student
>pointed out in a previous email, do we strictly follow the order in which
>the methods are declared in the class?
>
>Thanks,

Different compilers may handle vtables differenly as far as ordering
of the destructor is concerned. 

For the sake of HW4, use the ordering as in the Base class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-554-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:38:51 2003
Return-Path: <uhcosc1320-return-554-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774co5Z1194371
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:38:50 -0500 (CDT)
Received: (qmail 7056 invoked by uid 108); 7 Aug 2003 04:44:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32556 invoked from network); 7 Aug 2003 04:32:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070427.h774RWpV1155245@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 23:27:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] midterm3 ? (fwd)
Status: O
X-UID: 550
Content-Length: 1139
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Kinda offtopic to the exam questions, but how do you configure .net to
>keep the program console window open? In vsc++, like in the classroom,
>it keeps the window open after the program has finished running with a
>message "program has ended, press any key.. " (something like that). In
>.net 2k3, it exits automatically, and I have to insert a int a, cin >>
>a; just to see the output.

To execute, hold down the Ctrl key and hit F5 key. This should take
care of it. Let me know if this works for you.

>Another thing -- what is the output of assign4?
>
>2
>1
>1
>0
>Stack is empty.
>9
>10
>2.1
>10
>Stack is full. Can hold only 10 elements
>
>Is my output.
>
>Btw, you wrote "Stack if full" accidentally, throughout the program,
>replacing 'is' with 'if'
>
>Thanks =)

Oops, I forgot to post the output file. I am not at my computer as I
am typing this. But, I will post the output file by Thursday 
evening. Please check back at the assignment 4 web site for that.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-555-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:44:58 2003
Return-Path: <uhcosc1320-return-555-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774iv5Z1209917
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:44:58 -0500 (CDT)
Received: (qmail 10975 invoked by uid 108); 7 Aug 2003 04:50:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9368 invoked from network); 7 Aug 2003 04:47:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070442.h774gOYO1184751@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 23:42:24 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment copy constructor (fwd)
Status: O
X-UID: 551
Content-Length: 684
X-Keywords: $NotJunk                                                                                           

>While finishing up assign4, I was following up on big 3 and I came upon
>a problem. It is seeing the copy constructor as ambiguous since it is a
>StackType? What is __ctor? I assume it is the copy constructor's name?
>moreover, is it confusing with the constructor which is specified
>explicitly as an int with the copy constructor that could ALSO be an
>int? ARA!?!? 
> 
>...deleted... 

Based on the information you have provided, I can thing of little.
I may be able to help if you email me the source code of your Stack.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-556-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:45:27 2003
Return-Path: <uhcosc1320-return-556-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774jR5Z1209465
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:45:27 -0500 (CDT)
Received: (qmail 11435 invoked by uid 108); 7 Aug 2003 04:50:42 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6692 invoked from network); 7 Aug 2003 04:43:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070438.h774c5J71192617@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 23:38:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Midterm question#2 2002 (fwd)
Status: O
X-UID: 552
Content-Length: 1371
X-Keywords: $NotJunk                                                                                           

>Hello Dr. Venkat,
>
>There is a question asking the two forms of Inheritance, Which one is
>better and why?
>
>
>The only thing I could find is Public Inheritance (is-a) and Multiple
>Inheritance (kind-of). I do not know which is better and why.

There were students asking this after class this evening and I gave
them an answer. I mentioned Interface inheritance vs.  Implementation 
inheritance. 

Seeing your question in print, reminded me of that and I had not
understood what they were asking when I replied. So, here is
the correct response for it.

When you inherit you can inherit for extension or you can inherit
for restriction. In inherit for restriction, your derived class
withdraws functionality provided by the base. In the case of
inheritance by extensiblity, it adds functionlity. 

class Bird
{
public:
	void fly() {...}
};

class Parrot : public Bird
{
public:
	// Extends
	void fly() 
	{
		singWhileFlying();
		Bird::fly();
	}
	void singWhileFlying() {...}
};

class Penguin : Bird
{
public:
	// Restrictive
	void fly() 
	{
		throw CantFlyException(); // Exception class not shown
	}
};

The inheritance for extension is better as the other one violates
Liskov's Substition Principle (LSP).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-557-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug  6 23:51:57 2003
Return-Path: <uhcosc1320-return-557-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h774pu5Z1509569
	for <cosc155g@bayou.uh.edu>; Wed, 6 Aug 2003 23:51:57 -0500 (CDT)
Received: (qmail 15467 invoked by uid 108); 7 Aug 2003 04:57:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7653 invoked from network); 7 Aug 2003 04:44:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308070439.h774dPkW1198893@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 6 Aug 2003 23:39:25 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] virtual declaration (fwd)
Status: O
X-UID: 553
Content-Length: 532
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>I thought you had said in class that when you put virtual on a function in a Base class, in all the classes derived from the Base class the same function will be virtual?  Am I right?

Correct.

>Also, in your Examples in class you put virtual on all functions you are 
>overriding in the Derived class.  Is this just for clarity?
>Thanks for your help.

Yes.


Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-558-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 06:11:19 2003
Return-Path: <uhcosc1320-return-558-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77BBI5Z1292592
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 06:11:18 -0500 (CDT)
Received: (qmail 7289 invoked by uid 108); 7 Aug 2003 11:16:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6209 invoked from network); 7 Aug 2003 11:14:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071109.h77B9VYE1299156@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 06:09:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] assignment copy constructor (fwd)
Status: O
X-UID: 554
Content-Length: 287
X-Keywords: $NotJunk                                                                                           

>Also, can we make operator = protected or private? Or do we have to do
>it ? =)

Good question. I will let you decide this one.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-559-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 06:20:52 2003
Return-Path: <uhcosc1320-return-559-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77BKq5Z1332043
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 06:20:52 -0500 (CDT)
Received: (qmail 12878 invoked by uid 108); 7 Aug 2003 11:26:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7645 invoked from network); 7 Aug 2003 11:17:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071111.h77BBYn71294926@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 06:11:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Subject: Re: [uhcosc1320] old exam prob. (fwd)
Status: O
X-UID: 555
Content-Length: 2357
X-Keywords: $NotJunk                                                                                           

Excellent. This is the correct response and the bonus point goes to you.

Venkat

><P><BR><FONT face=ÐÂËÎÌå>Bonus: It violates the Liskov Substitutability Principle. <BR>Since the RemoteFileManager::copyFile will throws FileNotFound and NetworkConnection Exception while FileManager::copyFile will throws only FileNotFound exception.&nbsp; So the child class cannot 100% substitute into parent (base) class since it will throw extra exception.&nbsp; The extra exception might not be handled at all. <BR><BR>Did i get it right?</FONT></P>
;From the following: 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;class FileManager 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;{ 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;public: 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; virtual void copyFile(String sourceFileName, String targetFileName); 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; // Throws: throws FileNotFound Exception 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;... 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;}; 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;class RemoteFileManager : public FileManager 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;{ 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;public: 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; virtual void copyFile(String sourceFileName, String targetFileName); 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; // Throws: throws FileNotFound Exception and NetworkConnection Exception 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;... 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;}; 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; Are any principles being violated? If so, what? Explain why there may be a problem. 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; &gt;There isn't any principle being violated, correct, since the method is not being hidden? Thanks. 
><DIV></DIV>&gt; &gt; 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;Here is the next bonus question! 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;Any takers. I will forward the first correct response received. 
><DIV></DIV>&gt; 
><DIV></DIV>&gt;Venkat Subramaniam 
><DIV></DIV>&gt;-- 
><DIV></DIV>&gt;cosc155g@bayou.uh.edu Department of Computer Science 
><DIV></DIV>&gt;http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475 

From uhcosc1320-return-560-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 06:28:55 2003
Return-Path: <uhcosc1320-return-560-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77BSs5Z1339169
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 06:28:55 -0500 (CDT)
Received: (qmail 17532 invoked by uid 108); 7 Aug 2003 11:34:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13812 invoked from network); 7 Aug 2003 11:27:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071122.h77BMEbv1341696@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 06:22:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] VTABLE question (fwd)
Status: O
X-UID: 556
Content-Length: 1645
X-Keywords: $NotJunk                                                                                           

>Regarding the vtable for class B, how does the destructor of B get into the vtable if its not declared virtual?  
>Thanks.

If a method is virtual in base, it is virtual in derived as well.
If a destructor of Base is virtual, the destructor of Derived is
virtual as well. Once a method is virtual, it is always virtual in 
that hierarchy.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/06/03 10:18 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] VTABLE question (fwd)
>
>> 
>> >Venkat,
>> 
>>- I have a question about vtable. Does the destructor should be the first 
>function in vtable.
>> 
>
>For the sake of this homework, follow the function ordering in the
>base class.
>
>>- Another question:
>>Assume we have class like this:
>> 
>>class A 
>>{
>>        ~A();
>>        virtual void b();
>>        virtual void c();
>>};
>> 
>>class B
>>{
>>       virtual void b();
>>       virtual void d();
>>       ~B();
>>};
>> 
>> 
>>Then the vtable of a will be
>>~A
>>b
>>c
>> 
>>and of b
>>b
>>c
>>d
>>~B
>> 
>>or 
>>~B
>>b
>>c
>>d
>
>Both of them are wrong for the given code. Since the destructor
>of A is not virtual, the address of destructor will not appear in the
>vtable. If, however, ~A was virtual, then the second option given
>above for B will be correct.
>
>> 
>>Will the order of destructor of B  be the order of destructor of A?
>
>Yes.
>
>> 
>>Thanks
>> 
>
>Venkat
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-561-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 06:30:37 2003
Return-Path: <uhcosc1320-return-561-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77BUa5Z1345516
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 06:30:37 -0500 (CDT)
Received: (qmail 18570 invoked by uid 108); 7 Aug 2003 11:35:52 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16837 invoked from network); 7 Aug 2003 11:33:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071127.h77BRbo11350515@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 06:27:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] VTABLE question (fwd)
Status: O
X-UID: 557
Content-Length: 1472
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>In the example below there is no base class...right? Because B is not
>inheriting from A.

You are correct. But I assumed the person who wrote meant for B to
inherit from A.

>In that case would we just write the order of each class as if they were
>two distinct header files?

If B is not derived from A, yes you are correct.

Venkat

>
>Thanks,
>
>-----Original Message-----
>From: Dr. Venkat Subramaniam [mailto:cosc155g@Bayou.UH.EDU] 
>Sent: Wednesday, August 06, 2003 10:18 PM
>To: COSC 1320 Mailing List
>Subject: [uhcosc1320] VTABLE question (fwd)
>
>>Venkat,
>> 
>>- I have a question about vtable. Does the destructor should be the
>first function in vtable.
>> 
>
>For the sake of this homework, follow the function ordering in the
>base class.
>
>>- Another question:
>>Assume we have class like this:
>> 
>>class A 
>>{
>>        ~A();
>>        virtual void b();
>>        virtual void c();
>>};
>> 
>>class B
>>{
>>       virtual void b();
>>       virtual void d();
>>       ~B();
>>};
>> 
>> 
>>Then the vtable of a will be
>>~A
>>b
>>c
>> 
>>and of b
>>b
>>c
>>d
>>~B
>> 
>>or 
>>~B
>>b
>>c
>>d
>
>Both of them are wrong for the given code. Since the destructor
>of A is not virtual, the address of destructor will not appear in the
>vtable. If, however, ~A was virtual, then the second option given
>above for B will be correct.
>
>> 
>>Will the order of destructor of B  be the order of destructor of A?
>
>Yes.
>
>> 
>>Thanks
>> 
>
>Venkat

From uhcosc1320-return-562-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 06:36:39 2003
Return-Path: <uhcosc1320-return-562-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77Bad5Z1358394
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 06:36:39 -0500 (CDT)
Received: (qmail 22257 invoked by uid 108); 7 Aug 2003 11:42:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19839 invoked from network); 7 Aug 2003 11:37:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071132.h77BWS8Y1371825@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 06:32:28 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question on ABC (fwd)
Status: O
X-UID: 558
Content-Length: 3274
X-Keywords: $NotJunk                                                                                           

><html><div style='background-color:'><DIV>For a class to be ABC do all the functions need to be pure virtual or just one is fine. I believe that we need at least one function to be pure virtual and when that happens we can't create an object of it and the class is ABC. </DIV>
><DIV>&nbsp;</DIV>
><DIV>Am I right. </DIV>
><DIV>&nbsp;</DIV>

Correct. A class is considered ABC in C++ if it has at least one Pure 
Virutal Function or it derives from an ABC and does not override the
Pure Virtual Function(s).

><DIV>And can you please also confirm answers of the following. </DIV>
><DIV>MidTerm2 2002:</DIV>
><DIV>True/False</DIV>
><DIV>Conversion from Derived type to Base type requires explicit casting&nbsp; - False</DIV>
><DIV>&nbsp;Does this means that a base type pointer or reference can point to a derived type. </DIV>
><DIV>Or a derived type pointer can be assigned to a base type</DIV>
><DIV>&nbsp;</DIV>

You mean in the last statement, base type pointer.

Both.

><DIV>A C++ Abstract Base Class has only pure virtual functions - False</DIV>
><DIV>&nbsp;The answer to this one should be right if my understanding of ABC is right above. </DIV>
><DIV>Is there a special name for an ABC that has only pure virtual functions</DIV>

We call it an interface or some times I call it fully abstract base class.

><DIV>&nbsp;</DIV>
><DIV>2. Given the following class (do not change the given class in any way) [5 pts]:<BR>#include &lt;iostream.h&gt;<BR>class Counter<BR>{ public:<BR>	Counter (int initVal) : value(initVal) {}<BR>	virtual void increment() { value++; }<BR>	virtual void print(ostream&amp; out) const { out &lt;&lt; value &lt;&lt; endl; }<BR>protected:<BR>	int getValue() const { return value; }<BR>private:<BR>	int value;<BR>};<BR><BR>Write a class called BinaryCounter which inherits from the Counter class, with the following requirements:<BR>	(a). No initial value is required to create an object of BinaryCounter.<BR>(b). When an object of BinaryCounter is created, the initial value of counter will be 0.<BR>(c). The print function, when called on a BinaryCounter, will print either 0 or 1, depending<BR>	on the counter's value being even or odd, respectively.<BR></DIV>
><DIV>&nbsp;</DIV>
><DIV>class BinaryCounter: public Counter</DIV>
><DIV>{</DIV>
><DIV>public:</DIV>
><DIV>&nbsp;&nbsp; BinaryCounter():Counter(0){}</DIV>
><DIV>&nbsp;&nbsp; virtual void print(ostream&amp; out)</DIV>
><DIV>&nbsp;&nbsp; {</DIV>
><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( (getValue())%2 ==0)</DIV>
><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out&lt;&lt; 0&lt;&lt;endl;</DIV>
><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else</DIV>
><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; out&lt;&lt; 1 &lt;&lt; endl;</DIV>
><DIV>&nbsp;&nbsp;&nbsp;&nbsp; }</DIV>
><DIV>};</DIV>
><DIV>&nbsp;</DIV>
><DIV>Thanks a lot for your help</DIV>
><DIV>:)</DIV>

Would you do me a favor. Can you resent this code in plain text. It is
hard to head and it is going to take more than a few minutes to look 
at it and I have to leave in a few minutes to work.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-563-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 06:38:14 2003
Return-Path: <uhcosc1320-return-563-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77BcC5Z1391580
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 06:38:14 -0500 (CDT)
Received: (qmail 23278 invoked by uid 108); 7 Aug 2003 11:43:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20398 invoked from network); 7 Aug 2003 11:38:47 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071133.h77BXJ2t1369806@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 06:33:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Common Name (fwd)
Status: O
X-UID: 559
Content-Length: 374
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Indeed, after having my mailbox flooded with emails from "Venkat
>Subramaniam", I will think twice before considering your name unusual. This
>experience is to stay in my memory for a very long time.

:)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-564-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 06:45:22 2003
Return-Path: <uhcosc1320-return-564-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77BjL5Z1346293
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 06:45:21 -0500 (CDT)
Received: (qmail 27668 invoked by uid 108); 7 Aug 2003 11:50:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15154 invoked from network); 7 Aug 2003 11:30:05 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071124.h77BOcrp1348461@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 06:24:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] static/dynamic (fwd)
Status: O
X-UID: 560
Content-Length: 710
X-Keywords: $NotJunk                                                                                           

>Venkat,
>In an email you replied recently,  I don't understand
>what you meant by litmus test?  and how and where i
>can test with it?
>Also, could you please explain one more time about
>static and dynamic binding:  when we have it and how
>we know if it is static or dynamic.
>
>I'm still confused sometimes
>
>Thanks

Please visit the following URL and then write to me if you have questions:

http://www.cs.uh.edu/~svenkat/summer2003/ExamplesFromClass
Click on 07302003.zip.

Unzip this file and you will find a file called bindingLitmusTest.txt.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-565-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 06:51:26 2003
Return-Path: <uhcosc1320-return-565-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77BpQ5Z1434978
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 06:51:26 -0500 (CDT)
Received: (qmail 31562 invoked by uid 108); 7 Aug 2003 11:56:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16082 invoked from network); 7 Aug 2003 11:31:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071126.h77BQI631353660@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 06:26:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] VTABLE question (fwd)
Status: O
X-UID: 561
Content-Length: 724
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Should we also follow the function ordering in the base class for
>Midterm 3 problems regarding VTables?
>
>Also I was wondering if we change the order around in the example below,
>to for example:
>
>>class A 
>>{
>>        virtual void b();
>>        virtual void c();
>>        virtual ~A();
>>};
>> 
>>class B: public A
>>{
>	  virtual foo();
>>       virtual ~B();
>>       virtual void b();
>>       virtual void d();
>>};
>> 
>>
>
>The VTABLES will be the following:
>
>For A:
>
>b
>c
>~A
>
>For B:
>b
>c //because c is inherited from A...right?
>~B
>foo   //after ordering virtuals in the base, it orders the rest based on the
>d    //order in class B
>
>Thanks for your time,

Looks reasonable.

Venkat

From uhcosc1320-return-566-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 13:06:53 2003
Return-Path: <uhcosc1320-return-566-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77I6r5Z1532014
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 13:06:53 -0500 (CDT)
Received: (qmail 24570 invoked by uid 108); 7 Aug 2003 18:12:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13205 invoked from network); 7 Aug 2003 17:59:40 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071754.h77HsBMv1493016@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 12:54:11 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Clarifying Binding and Hiding (fwd)
Status: O
X-UID: 562
Content-Length: 5415
X-Keywords: $NotJunk                                                                                           

>Hi 
> 
>In the problem solved in following e-mail, in the VTables of both 'Derived' and 'Derived2',
>shdn't it be
>Base::f3(int a)
> 
>Thanks

You are correct. Those two should read Base::f3(int a). There is no
Derived::f3(int a) or Derived2::f3(int a) methods.

>"Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU> wrote:
>>Venkat,
>>
>>Could you please take a look at the example from class and see if the comments I added are correct. I have included the reasons I believe them to be correct at the end of the code.
>>
>>#include 
>>using namespace std;
>>
>>class Base
>>{
>>public:
>> virtual void f1() { cout << "Base::f1" << endl; }
>> void f2() { cout << "Base::f2" << endl; }
>> virtual void f3(int a)
>> {
>> cout << "Base::f3" << endl;
>> }
>>};
>>
>>class Derived : public Base
>>{
>>public:
>> virtual void f1() { cout << "Derived::f1" << endl; }
>> void f2() { cout << "Derived::f2" << endl; }
>> virtual void f3(double a)
>> {
>> cout << "Derived::f3" << endl;
>> }
>>};
>>
>>void main()
>>{
>> Derived obj;
>> Base* ptr = &obj;
>>
>> obj.f1(); //Static Derived::f1
>> obj.f2(); //Static Derived::f2
>> obj.f3(2); //Static Derived::f3
>> cout << "----------" << endl;
>> ptr->f1(); //Dynamic
>> ptr->f2(); //Static Base::f2
>> ptr->f3(2); //Dynamic
>>
>>}
>>
>>The first three static are static because they are called on "true" objects not pointers or references, correct?
>>
>>The first dynamic is dynamic because ptr is a pointer to a Base type and in the Base class f1 is virtual, correct?
>>
>>The next static is static because ptr is a pointer to a Base type and in the Base class f2 is not virtual, correct?
>>
>>The second dynamic is dynamic for same reason the first dynamic is dynamic, correct? Even though the signature is different in the base and derived (i.e. Hiding)
>>
>
>Excellent!!!!!!! Hats off! Congratulations++ 
>
>>The vtable diagram for this example would be:
>>VTABLE OF BASE
>>Base::f1
>>Base::f3(int a)
>>
>>VTABLE OF DERIVED
>>Derived::f1
>>Derived::f3(int a)
>>Derived::f3(double a)
>>
>>Now lets say I add a Class Derived2.. The new code looks like this:
>>
>>#include 
>>using namespace std;
>>
>>class Base
>>{
>>public:
>> virtual void f1() { cout << "Base::f1" << endl; }
>> void f2() { cout << "Base::f2" << endl; }
>> virtual void f3(int a)
>> {
>> cout << "Base::f3" << endl;
>> }
>>};
>>
>>class Derived : public Base
>>{
>>public:
>> virtual void f1() { cout << "Derived::f1" << endl; }
>> void f2() { cout << "Derived::f2" << endl; }
>> virtual void f3(double a)
>> {
>> cout << "Derived::f3" << endl;
>> }
>>};
>>
>>class Derived2:public Derived
>>{
>>public:
>> virtual void f1() { cout << "Derived2::f1"<< endl;}
>> void f2() { cout << "Derived2::f2" << endl; }
>> virtual void f3(double a)
>> {
>> cout << "Derived2::f3" << endl;
>> }
>>};
>>
>>void main()
>>{
>> Derived obj;
>> Derived2 other;
>> Base* ptr = &obj;
>> Derived* dptr = &other;
>> Base* bptr = &other;
>>
>> obj.f1(); //Static Derived::f1
>> obj.f2(); //Static Derived::f2
>> obj.f3(2); //Static Derived::f3
>> cout << "----------" << endl;
>> ptr->f1(); //Dynamic
>> ptr->f2(); //Static Base::f2
>> ptr->f3(2); //Dynamic
>> cout <<"--------------"<> dptr->f1(); //Dynamic
>> dptr->f2(); //Static Derived::f2
>> dptr->f3(3.5); //Dynamic
>> cout <<"------------------"<> bptr->f1(); //Dynamic
>> bptr->f2(); //Static Base::f2
>> bptr->f3(3.5); //Dynamic
>>}
>
>Wonderful.
>
>>
>>In the second block of pointers calling the functions I have a pointer to the first derived class. Derived2 Inherits from Derived not Base (directly).
>>
>>The first dynamic is dynamic because dptr is a pointer to a Derived type and in the Derived class f1 is virtual, correct?
>>
>>The next static is static because ptr is a pointer to a Derived type and in the Derived class f2 is not virtual, correct?
>>
>>The second dynamic is dynamic for same reason the first dynamic is dynamic, correct? 
>>
>>Now in the third block of pointers calling the functions I have a pointer to base class. The object is really a Derived2 object which does not inherit from Base directly. This code ran and produced output that I thought it should. Let me know if I have messed up the logic of Binding or Inheritance.
>>
>>The first dynamic is dynamic because bptr is a pointer to a Base type and in the Base class f1 is virtual, correct?
>>
>>The next static is static because bptr is a pointer to a Base type and in the Base class f2 is not virtual, correct?
>>
>>The second dynamic is dynamic for same reason the first dynamic is dynamic, correct? Even though the signature is different in the base and derived2 (i.e. Hiding)
>>
>>The vtable chart for this new code is:
>>VTABLE OF BASE
>>Base::f1
>>Base::f3(int a)
>>
>>VTABLE OF DERIVED
>>Derived::f1
>>Derived::f3(int a)
>>Derived::f3(double a)
>>
>>VTABLE OF DERIVED2
>>Derived2::f1
>>Derived2::f3(int a) // Do I really have this in the Vtable Because I did not Inherit it directly from Base. I am thinking that I should have it there because as I Inherit from Derived I am getting Base for free. Because of the Memory piggy backing that Inheriting does.
>>Derived2::f3(double a)
>>
>
>You are unbeatable on this one. What ever you have done, just do it
>in the exam and you will come out with flying colors. Great.
>
>Venkat Subramaniam
>-- 
>cosc155g@bayou.uh.edu Department of Computer Science
>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-567-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 13:14:15 2003
Return-Path: <uhcosc1320-return-567-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77IEA5Z1476690
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 13:14:14 -0500 (CDT)
Received: (qmail 31066 invoked by uid 108); 7 Aug 2003 18:19:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9383 invoked from network); 7 Aug 2003 17:55:24 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071749.h77HnqWx1493289@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 12:49:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] assignment copy constructor (fwd)
Status: O
X-UID: 563
Content-Length: 1353
X-Keywords: $NotJunk                                                                                           

>> >While finishing up assign4, I was following up on big 3 and I came upon
>> >a problem. It is seeing the copy constructor as ambiguous since it is a
>> >StackType? What is __ctor? I assume it is the copy constructor's name?
>> >moreover, is it confusing with the constructor which is specified
>> >explicitly as an int with the copy constructor that could ALSO be an
>> >int? ARA!?!?=20
>> >=20
>> >...deleted...=20
>>=20
>> Based on the information you have provided, I can thing of little.
>> I may be able to help if you email me the source code of your Stack.
>>=20
>> Venkat Subramaniam
>
>If I remember correctly, __ctor is some initial code provided by the
>libc.a (the initial code that starts your main) that initializes all the
>static objects and constructors and stuff of that nature.  There is a
>related __dtor that does the reverse.  They are compiler provided
>functions that you can't override.  They can only be removed by not
>linking in libc.a (which is usually done by default), at which point you
>would have to provide your own startup code.

The student who had the original question wrote back that it
was a simple mistake that caused this error and took care of it!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-568-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 13:14:24 2003
Return-Path: <uhcosc1320-return-568-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77IEO5Z1557402
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 13:14:24 -0500 (CDT)
Received: (qmail 31456 invoked by uid 108); 7 Aug 2003 18:19:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22542 invoked from network); 7 Aug 2003 18:10:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071804.h77I4pZA1540165@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 13:04:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] resending you the code with appologies :) (fwd)
Status: O
X-UID: 564
Content-Length: 1400
X-Keywords: $NotJunk                                                                                           

>2. Given the following class (do not change the given class in any way) [5
>pts]:
>#include <iostream>
>class Counter
>{ public:
>     Counter(int initVal) : value(initVal) {}
>     virtual void increment() { value++; }
>     virtual void print(ostream& out) const { out << value << endl;}
>  protected:
>     int getValue() const { return value; }
>  private:
>    int value;
>};
>
>Write a class called BinaryCounter which inherits from the
>Counter class, with the following requirements:
>(a). No initial value is required to create an object of BinaryCounter.
>(b). When an object of BinaryCounter is created, the initial value of 
>counter will be 0.
>(c). The print function, when called on a BinaryCounter, will print either 0 
>or 1,
>depending on the counter's value being even or odd, respectively.
>
>class BinaryCounter: public Counter
>{
>public:
>BinaryCounter():Counter(0){}
>virtual void print(ostream& out)
>{
>   if ( (getValue())%2==0)
>           out<< 0 << endl;
>   else
>           out<< 1 << endl;
>             </DIV>

All except this </DIV> is correct!

>}
>};
>
>I am sorry, I didn't realize that you will be getting all those junk 
>characters. I had the Rich Text editor turned on.
>I hope this help,
>
>Thanks

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-569-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 13:19:17 2003
Return-Path: <uhcosc1320-return-569-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77IJH5Z1059565
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 13:19:17 -0500 (CDT)
Received: (qmail 3600 invoked by uid 108); 7 Aug 2003 18:24:35 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16285 invoked from network); 7 Aug 2003 18:03:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071757.h77HvXib1511085@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 12:57:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Doubt Regrading Static and Dynamic Binding (fwd)
Status: O
X-UID: 565
Content-Length: 2237
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
> 
>I have a small question regarding the following mail.
> 
>MY QUESTION:
>
>3. ref = obj2;
> 
> My understanding is:
> 
>Compile Time:
> 
>For this since the method 'operator=' is being called on reference, and since the method is virtual in the class of type of reference (i.e. class A), compiler determines this as 
>dynamic binding at compile time.And then it says,at run time,it will go to the class of type of what ref is pointing to(i.e. the reference or pointer or object).
> 
>YOUR REASONING:
>
>Same reasoning as above applies to this as well. At compile time, it
>decides dynamic binding. But it has to decide the method name and
>signature. So, it says, I will call at runtime a method operator=
>which takes a reference to A. Why reference to A. That is all it
>can find in A and it figures it can treat object of B (obj2) can be
>treated as A.
>
>So, it modifies
>
>ref = obj2;
>
>as 
>
>A& tempRef = obj2;
>ref = tempRef;
>
>MY DOUBT: 
> 
>You said  "it figures it can treat object of B(obj2) can treated as A."
> 
>Q--Does this figuring happens at compile time?

Yes.

>If so,based on what reasoning(how)  does the compiler figures it can treat object of B(obj2) as A? ------------------------//Doubt
> 

Based on the fact that B inherits from A.

>I got this doubt because at compile time the compiler doesn't know what type of object(or  reference or pointer)  is going to come at run time.(i mean for ref=obj2, it doesn't have any idea whether 'ref' is pointing to an 'object or reference or pointer' at compile time).
> 

Correct. But it does know what obj2 is. When we say obj2 can be treated
as A, we are talking about obj2 and not ref.

>MY QUESTION:
> 
>Run Time:
> 
>Since, in this case, the right-side operand obj is object of B compiler goes to 'operator=' of class B at run time(due to polymorphism) and asks if it has an 'operator=' which takes as an argument an object of type B and if so the code is executed.IF NOT COMPILER GOES TO THE BASE CLASS (operator=) and executes that code.
> 
>
>YOUR REASONING:
>
>Same reasoning as above applies here again.
>
>
> 
>I hope i am making sense.Sorry for troubling you.Thanks for the help.
> 
>Thanks and Regards.

That's no trouble at all.

Venkat

From uhcosc1320-return-570-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 13:24:29 2003
Return-Path: <uhcosc1320-return-570-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77IOS5Z1071364
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 13:24:28 -0500 (CDT)
Received: (qmail 8661 invoked by uid 108); 7 Aug 2003 18:29:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23859 invoked from network); 7 Aug 2003 18:11:34 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071806.h77I66Kf1531686@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 13:06:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assign4--Question for the OverLoading Operator= (fwd)
Status: O
X-UID: 566
Content-Length: 670
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>  Do we need to check if two types are the same by using dynamic cast in this assignment? Also, check if their maximum size are the same?
>For example,
>
>{
>Stack<int> stkNum(10);
>Stack<char> stkLetter(10);  //Altough they have the same maximum size,
>
>...
>
>stkNum = stkLetter;  //Not allow to do this since two different type!!

This will generate a compilation error. Say thanks compiler and move on.

>}
>
>and the implement should be including the overloading operator=
>
>...deleted... 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-571-cosc155g=bayou.uh.edu@agiledeveloper.com Thu Aug  7 13:25:46 2003
Return-Path: <uhcosc1320-return-571-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h77IPk5Z1059464
	for <cosc155g@bayou.uh.edu>; Thu, 7 Aug 2003 13:25:46 -0500 (CDT)
Received: (qmail 9924 invoked by uid 108); 7 Aug 2003 18:31:03 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20785 invoked from network); 7 Aug 2003 18:08:11 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308071802.h77I2cxo1524729@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Thu, 7 Aug 2003 13:02:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 4 Clarification (fwd)
Status: O
X-UID: 567
Content-Length: 1161
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Does the code I have written look to be enough for my exception handling in 
>assignment 4?  It compiles just fine; however, I am just not sure if I am 
>using namespace correctly.  I mean have I split the interface and 
>implementation properly?  Also, have I deduced what is needed from your 
>assign4.cpp file for an effective exception handling.  I mean I don't need 
>any methods for the StackEmpty because the catch only looks for a reference 
>to a class StackEmpty.  

It does not need any method because, none from this class is used in main.

>And, I needed the two methods and a private variable 
>to satisfy the catch  for StackFull. This is my understanding at the moment.  
>When I step back and look at it I am just not sure.  
>
>Here is my Exceptions.h file: Are my comments correct as well?
>
>//In this file, write the two Exception classes.
>
> ...deleted...
>Any clarification would be greatly appreciated.

It looks good to me. You are thinking in the right direction.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-573-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:28:21 2003
Return-Path: <uhcosc1320-return-573-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785SL5Z1555890
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:28:21 -0500 (CDT)
Received: (qmail 32337 invoked by uid 108); 8 Aug 2003 05:33:46 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25753 invoked from network); 8 Aug 2003 05:24:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080519.h785JFdu1530192@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:19:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Output question (fwd)
Status: O
X-UID: 568
Content-Length: 1430
X-Keywords: $NotJunk                                                                                           

>Dr.Venkat,
>
>I was wondering if you could explain to me why Animal makesNoise and Dog  MakesNoise get called two times in a row in the following code.?
>
>#include <iostream.h>
>class Animal {	public:
>	void eat() { 
>cout << "Animal Eats\n"; 
>makeNoise();							

According to this code, after the animal eats, it makes noise. Read on.

>}
>	virtual void makeNoise() { cout << "Animal makesNoice\n"; }
>};
>class Cat : public Animal { public:
>	virtual void eat() { cout << "Cat Eats\n"; } // Cat eat's quietly
>	virtual void sleepAllDay() { cout << "zzzzzzz scatch zzzzzz\n"; }
>};
>class Dog: public Animal { public:
>	void makeNoise() { cout << "Dog makesNoice\n";}
>	virtual void wagTheTail() { cout << "Wagwag\n"; };
>};
>      void playWithAnimal(Animal& animal)	{
>	animal.eat();							
>	animal.makeNoise();						

Here call to eat will call makeNoise as discussed above. Then we
are calling makeNoise again.

>      }
>      void playWithCat(Cat& aCat)	{
>	aCat.eat();							
>	aCat.sleepAllDay();					
>      }
>      void main()	{
>	Cat snow;
>	snow.eat();							
>	snow.makeNoise();						
>	playWithAnimal(snow);					
>	playWithCat(snow);						
>	Dog spin;
>	spin.eat();							
>	spin.makeNoise();						
>	playWithAnimal(spin);					
>      }
>
>Thank You,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-572-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:28:23 2003
Return-Path: <uhcosc1320-return-572-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785SN5Z1552909
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:28:23 -0500 (CDT)
Received: (qmail 32147 invoked by uid 108); 8 Aug 2003 05:33:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14121 invoked from network); 8 Aug 2003 05:08:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080503.h7853K6v1478919@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:03:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] static or dynamic (fwd)
Status: O
X-UID: 569
Content-Length: 471
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>
>Would you please clarify my answer for the question below:
>class Base 
>{ public:
>    virtual ~Base() {}
> 
>    virtual void f1()
>    {
>        cout << "Base::f1()" << endl;
>    }
>};
> 
>class Derived : public Base 
>{ public:
>    virtual ~Derived() {}
> 
>    virtual void f1()
>    {
>        Base::f1();         //  _STATIC because it is called on class_
>             ...
>       }
>};
>
>Thank you very much.

Sounds reasonable to me.

Venkat

From uhcosc1320-return-574-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:30:33 2003
Return-Path: <uhcosc1320-return-574-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785UX5Z1557550
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:30:33 -0500 (CDT)
Received: (qmail 1666 invoked by uid 108); 8 Aug 2003 05:35:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12548 invoked from network); 8 Aug 2003 05:06:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080501.h78516Si1477608@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:01:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] aboutRTTI (fwd)
Status: O
X-UID: 570
Content-Length: 1027
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>For the question on #5 in 2001 mid3:=20
>5.  5.       Given a class [10 pts]
>class Microwave
>{
>virtual void cook(int seconds);
>virtual void stop();
>virtual const char* getStatus() const;
>=E2=80=A6
>};
>=20
>Write a ChimingMicrowave which will play a musical chime when cook or stop i=
>s=20
>called. It also has a function called mute which will toggle the mute state=20
>of the microwave. Write your ChimingMicrowave so that it may be used any whe=
>re=20
>a Microwave may be used. Assume a class called Chimer (in Chimer.h) with a=20
>function void chime() is available for you to use.=20
>=20
>=20
>My question : is the "mute state"  in the base class as a private member=20
>variable or we should provide in the derived class ChimingMicrowave ?
>Thank you very much.

There is no mute state in the base class. It is needed in the 
derived class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-575-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:30:43 2003
Return-Path: <uhcosc1320-return-575-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785Ug5Z1562363
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:30:42 -0500 (CDT)
Received: (qmail 1892 invoked by uid 108); 8 Aug 2003 05:36:03 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26450 invoked from network); 8 Aug 2003 05:25:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080520.h785KC5s1527205@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:20:12 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Information from class (fwd)
Status: O
X-UID: 571
Content-Length: 359
X-Keywords: $NotJunk                                                                                           

>Where is the file with the information you were writting down in class today?  I looked for it under today's folder but it wasn't there.  

Oh sorry, I did not save any thing from the review session.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-576-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:32:46 2003
Return-Path: <uhcosc1320-return-576-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785Wi5Z1559977
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:32:44 -0500 (CDT)
Received: (qmail 3353 invoked by uid 108); 8 Aug 2003 05:38:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16331 invoked from network); 8 Aug 2003 05:11:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080506.h7856HDr1487240@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:06:17 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assign4--Question for the OverLoading Operator= (fwd)
Status: O
X-UID: 572
Content-Length: 445
X-Keywords: $NotJunk                                                                                           

>For assign4, will there be any assignment of one object to another (operator=), regardless of the type and array size?  I ask because you don't mention anything such on the instructions or on the test source.  

Good question. I will let you make the decision on what to do about this.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-577-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:34:15 2003
Return-Path: <uhcosc1320-return-577-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785YF5Z1050746
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:34:15 -0500 (CDT)
Received: (qmail 4422 invoked by uid 108); 8 Aug 2003 05:39:35 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3131 invoked from network); 8 Aug 2003 05:37:44 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080532.h785WD5J1568623@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:32:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] BONUS QUESTION (fwd)
Status: O
X-UID: 573
Content-Length: 1817
X-Keywords: $NotJunk                                                                                           

Sorry, readability to sacrifies significant performance? Can you imagine
what happens on large sized arrays.  

This was discussed in class and we opted to go the route we took
for performance. 

Disqualified. No bonus point earned!

Venkat


>If I remember correctly, the bonus question is to fix your FiFo code so that 
>it will return false when it is supposed to and not return false when it is 
>not supposed to.  I took the advice you gave us at the beginning of the 
>semester that, if we come across someone else's code that is a nightmare to 
>understand and debug, we are better off rewriting it completely.  My code 
>may not be quite as efficient as your's, but it is WAY more readable.  The 
>only thing I changed that may mess up the user code is I renamed the 
>function, size() to Size() b/c my compiler wouldn't let me have a function 
>int size() and a variable int size.
>
>
>class FiFo
>{
>public:
>	FiFo(int theMaxSize)
>	{
>		maxSize = theMaxSize;
>		pElements = new int[maxSize];
>		size = 0;
>	}
>	bool add(int a)
>	{
>		if(size == maxSize)
>			return false;
>		for(int n=size-1;n>=0;n--)
>			pElements[n+1] = pElements[n];
>		pElements[0] = a;
>		size++;
>		return true;
>	}
>	bool remove(int& value)
>	{
>		if(size == 0)
>			return false;
>		value = pElements[size-1];
>		size--;
>		return true;
>	}
>
>	int max() const { return maxSize; }
>	int GetSize() const
>	{
>		return size;
>	}
>private:
>	int maxSize;
>	int* pElements;
>	int size;
>};
>
>_________________________________________________________________
>Add photos to your messages with MSN 8. Get 2 months FREE*.  
>http://join.msn.com/?page=features/featuredemail
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-578-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:34:52 2003
Return-Path: <uhcosc1320-return-578-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785Yp5Z1563372
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:34:51 -0500 (CDT)
Received: (qmail 4930 invoked by uid 108); 8 Aug 2003 05:40:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19611 invoked from network); 8 Aug 2003 05:16:35 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080511.h785B4A01493297@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:11:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] static and dynamic (fwd)
Status: O
X-UID: 574
Content-Length: 741
X-Keywords: $NotJunk                                                                                           

><P>Dr. Venkat,</P>
><P>can you please explain in common English term what is static and dynamic binding one more time. thanks<BR><BR></P></DIV>

Static binding is when the compiler, at the time of compilation,
can figure out which function it is going to call. It puts the
jump to the address of the function at the place of call at compile
time.

If it can not determine this at compile time, that is if the call is
polymorphic, then the decision as to which method to call is
postponed to run time (by the user of virtual table). This is called
dynamic binding.

Hope this helps.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-579-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:39:28 2003
Return-Path: <uhcosc1320-return-579-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785dS5Z1066133
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:39:28 -0500 (CDT)
Received: (qmail 8522 invoked by uid 108); 8 Aug 2003 05:44:53 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6761 invoked from network); 8 Aug 2003 05:42:29 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080536.h785awLD1058464@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:36:58 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] bonus point (fwd)
Status: O
X-UID: 575
Content-Length: 720
X-Keywords: $NotJunk                                                                                           

>The solution is very simple.
>
>In the private create a variable.  Lets call it donut.
>
>In the initializer initialize donut to 1.
>
>In bool replace
>if (bottomOfList - topOfList == maxSize - 1)
>				full = true;
>
>with
>if (bottomOfList - topOfList == maxSize - donut){
>full = true;
>donut=0;
>}
>
>I would have emailed you a fully corrected copy however the files for today 
>have not been posted.

I would prefer calling the variable pizza or may be onion, why donut?
I will see if I receive any better response before deciding the 
donut, I mean bonus.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-580-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:42:23 2003
Return-Path: <uhcosc1320-return-580-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785gN5Z1066763
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:42:23 -0500 (CDT)
Received: (qmail 10711 invoked by uid 108); 8 Aug 2003 05:47:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13611 invoked from network); 8 Aug 2003 05:08:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080502.h7852ceJ1445897@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:02:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Subject: [uhcosc1320] Old Exam Question: Counter program (fwd)
Status: O
X-UID: 576
Content-Length: 2039
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>I have a questions regarding the old exams.
>
>Midterm3 2000 
>4.  What is the output of the following program [5]?
>
>#include <iostream.h>
>
>class Counter                                         
>                                      
>
>{ public:
>
>        Counter() { value = 0; }
>
>        virtual void increment() { value++; }
>
>        virtual int getValue() { return value; }
>
>protected:
>
>        void setValue(int val) { value = val; }
>
>private:
>
>        int value;
>
>};
>
> 
>
>class ModCounter : public Counter
>
>{ public:
>
>        ModCounter(int rLimit) { limit = rLimit; }
>
>        virtual void increment()
>
>        {
>
>                        if (getValue() == limit - 1) 
>setValue(0);
>
>                        Counter::increment();
>
>        }
>
> 
>
>        virtual int getLimit() { return limit; }
>
>private:
>
>        int limit;
>
>};
>
> 
>
>void function(Counter& c1, Counter& c2) { c1 = c2; }
>
> 
>
>void main()
>
>{
>
>        Counter ctr1;
>
>        Counter ctr2;
>
>        ctr2.increment();
>
> 
>
>        function(ctr1, ctr2);
>
>        cout << ctr1.getValue() << endl;
>
> 
>
>        ModCounter m1(3), m2(4);
>
>        m2.increment();
>
> 
>
>        function(m1, m2);
>
>        cout << m1.getValue() << endl;
>
>        cout << m1.getLimit() << endl;
>
>}
>
>OUTPUT:
>1
>1
>3
>
>   5. Is there a problem with the above program… is
>the output what it is supposed to be? If not, explain
>why?
>
>The output is suppose to be 1,1,4. Is it because there
>isn't a user-defined copy constructor and the program
>is making a shallow copy. It's only copying the
>counter's value and not the limit also? 
>
>Thanks for your time.

The issue here has to do with the lack of virtual operator=
in base. You need to override and overload the operator=
in the derived as well. Issues that you faced in assignment 3.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-581-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:42:58 2003
Return-Path: <uhcosc1320-return-581-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785gw5Z1080804
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:42:58 -0500 (CDT)
Received: (qmail 11232 invoked by uid 108); 8 Aug 2003 05:48:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23851 invoked from network); 8 Aug 2003 05:22:05 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080516.h785GYsI1517258@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:16:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] RTTI and Open-Closed (fwd)
Status: O
X-UID: 577
Content-Length: 1239
X-Keywords: $NotJunk                                                                                           

>Venkat,
>I'm having trouble with the concepts of RTTI and Open-Closed code.  I've
>reviewed the slides presented in class on these two subjects, but I'm still
>kind of clueless as how to answer old test questions relating to these
>concepts.
>
>For example, question 9 of Midterm 3 of 2002 deals with RTTI.  I'm not sure
>what kind of code to write there.  And question 7 of Midterm 3 of 1999 deals
>with Open-Closed principles.  I don't know how what approach I should take
>to solve that problem.  Any tips you can provide would be greatly
>appreciated.
>Thanks,

RTTI in C++ is implemented using dynamic_cast.

Let's say you use dynamic cast for example within the 
copy constructor of Car class to decide what type of Engine you have.
You can look at the Virtual Constructor example from Monday.
This use of RTTI leads to extensiblity problem and will fail
OCP as well.

However, if within operator=, if you check to see if the
received object is of the same type as the class you are in,
(as in assignment 3) then this use of RTTI will not lead to 
any extensibility issues.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-582-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:43:07 2003
Return-Path: <uhcosc1320-return-582-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785h75Z1077575
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:43:07 -0500 (CDT)
Received: (qmail 11420 invoked by uid 108); 8 Aug 2003 05:48:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30249 invoked from network); 8 Aug 2003 05:30:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080525.h785PSE11549669@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:25:27 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] midterm 3 questions (fwd)
Status: O
X-UID: 578
Content-Length: 1065
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>I have 2 questions,
>
>1)  do we need to know open-close principles for exam 3?

It is part of the topics that is covered. In fact, this is
one of the most fundamental principles as it relates to
extensiblity which is the core of OO. Knowing this principle,
one would write OO code. Otherwise it is merely OhOh.

>2)  class X {public:  virtual void f(); // f will return an even number
>};
>class Y : public X { public:  virtual void f(); // f will return either 3 or any even number
>};
>Are we in violation of any principles? If so, what are the consequences of this?
>
>This violates LSP.  At runtime X may be substituted for Y, and an exception may be received that was unexpected.  This may result in a crash.  The compiler needs to know which derived class is being substituted.
>
>Is this correct?
>
>Thank You,

The reasons are in the right direction and yes it is violation of LSP.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-583-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:49:47 2003
Return-Path: <uhcosc1320-return-583-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785nk5Z1099488
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:49:46 -0500 (CDT)
Received: (qmail 16217 invoked by uid 108); 8 Aug 2003 05:55:02 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10595 invoked from network); 8 Aug 2003 05:47:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080542.h785gATk1068729@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:42:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Writing the default virtual destructor... (fwd)
Status: O
X-UID: 579
Content-Length: 1128
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>Take the example:
>
>class A
>{
>   virtual ~A();
>   virtual method1();
>   void foo();
>};
>
>class B
>{
>   virtual method2();
>};
>
>When we draw our VTable how would we draw the default virtual destructor of B?
>
>Would it be:
>
>For VTable A:
>A::~A()
>A::method1()
>
>For VTable B:
>B::~B()     // Doubts regarding this
>A::method1()
>B::method2()
>

The above is correct.

>or will it be:
>... snip ...
>
>In other words do I draw a pointer from VTable B to A's destructor or do I draw a pointer from VTable B to B's default destructor and label it as B::~B()?
>
>Thanks for your time.


1. If a function is virtual, it remains virtual down the hieararchy.
2. Destructors are functions (more or less)
3. If you do not write a destructor, the compiler writes one.
4. If the base destructor is virtual, add classes derived from it
	also have virtual destructors, one written by you if you write one
	that is or the one auto generated by the compiler.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-584-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 00:59:01 2003
Return-Path: <uhcosc1320-return-584-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h785x15Z1126057
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 00:59:01 -0500 (CDT)
Received: (qmail 23694 invoked by uid 108); 8 Aug 2003 06:04:26 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15508 invoked from network); 8 Aug 2003 05:10:40 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308080505.h78558Mt1471052@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 00:05:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] my assignment 3 (fwd)
Status: O
X-UID: 580
Content-Length: 1543
X-Keywords: $NotJunk                                                                                           

>hey Venkat 
> 
>i am getting these errors when i compile my ModCounter with your Test and new Counter.cpp, and Counter.h:
> 
>unresolved external symbol "public: virtual __thiscall ModCounter::~ModCounter(void)" (??1ModCounter@@UAE@XZ)
>
>Test3.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall Counter::~Counter(void)" (??1Counter@@UAE@XZ)
>
>Test3.obj : error LNK2001: unresolved external symbol "public: int __thiscall Counter::getCounterValue(void)const " (?getCounterValue@Counter@@QBEHXZ)
>
>Test3.obj : error LNK2001: unresolved external symbol "public: __thiscall 
>ModCounter::ModCounter(int)" (??0ModCounter@@QAE@H@Z)
>
>Test3.obj : error LNK2001: unresolved external symbol "public: int __thiscall Counter::getCounterValue2(void)const " (?getCounterValue2@Counter@@QBEHXZ)
>
>Test3.obj : error LNK2001: unresolved external symbol "public: __thiscall ModCounter::ModCounter(class ModCounter const &)" (??0ModCounter@@QAE@ABV0@@Z)
>
>Debug/Test3.exe : fatal error LNK1120: 6 unresolved externals
>Error executing link.exe.
> 
>What do these mean can you help please?

I am not too sure. One thing to check is to see if you have the
Counter.cpp being compiled as part of the project. You can click
on Project menu, Add Files and add the Counter.cpp file to the
project. If that does not work, email me the project (zip) and
I will take a look at it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-585-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 06:56:53 2003
Return-Path: <uhcosc1320-return-585-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h78Buq5Z1143365
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 06:56:52 -0500 (CDT)
Received: (qmail 18533 invoked by uid 108); 8 Aug 2003 12:02:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17138 invoked from network); 8 Aug 2003 12:00:38 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308081155.h78Bt5G81127832@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 06:55:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Writing the default virtual destructor... (fwd)
Status: O
X-UID: 581
Content-Length: 2997
X-Keywords: $NotJunk                                                                                           

>Venkat,
>I think we don't need to write default destructor ~B
>in the VTable, right? or we have to since the base
>class has a destructor there?

Here is what I mentioned in the previous email.
---> 1. If a function is virtual, it remains virtual down
---> the hieararchy.
---> 2. Destructors are functions (more or less)
---> 3. If you do not write a destructor, the compiler
---> writes one.
---> 4. If the base destructor is virtual, the classes
---> derived from it also have virtual destructors, 
---> one written by you if you write one that is or 
---> the one auto generated by the compiler.

If base class has a virtual destructor, then the derived class
also automatically has a virtual destructor. This is the case
if one you write or the compiler writes. Now, both the classes
have a virtual destructor right? If both classes have a virtual
destructor, then in each of the VTable there will be an entry
for the destructor. Each entry will point to its own destructor,
as shown below in the previous email.

>What if in both base class and derived class don't
>have destructor, should we write them out in VTable as
>well

If both classes do not have destructor, then the destructors are not
virtual. If a function is not virtual, it does not appear in the
VTable. So, the answer here is no.

>
>Thanks
>
>--- "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>wrote:
>> >Hi Venkat,
>> >Take the example:
>> >
>> >class A
>> >{
>> >   virtual ~A();
>> >   virtual method1();
>> >   void foo();
>> >};
>> >
>> >class B
>> >{
>> >   virtual method2();
>> >};
>> >
>> >When we draw our VTable how would we draw the
>> default virtual destructor of B?
>> >
>> >Would it be:
>> >
>> >For VTable A:
>> >A::~A()
>> >A::method1()
>> >
>> >For VTable B:
>> >B::~B()     // Doubts regarding this
>> >A::method1()
>> >B::method2()
>> >
>> 
>> The above is correct.
>> 
>> >or will it be:
>> >... snip ...
>> >
>> >In other words do I draw a pointer from VTable B to
>> A's destructor or do I draw a pointer from VTable B
>> to B's default destructor and label it as B::~B()?
>> >
>> >Thanks for your time.
>> 
>> 
>> 1. If a function is virtual, it remains virtual down
>> the hieararchy.
>> 2. Destructors are functions (more or less)
>> 3. If you do not write a destructor, the compiler
>> writes one.
>> 4. If the base destructor is virtual, add classes
>> derived from it
>> 	also have virtual destructors, one written by you
>> if you write one
>> 	that is or the one auto generated by the compiler.
>> 
>> Venkat Subramaniam
>> --				
>> cosc155g@bayou.uh.edu		Department of Computer
>> Science
>> http://www.cs.uh.edu/~svenkat 	University of
>> Houston, Houston, Tx 77204-3475
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-586-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 12:34:31 2003
Return-Path: <uhcosc1320-return-586-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h78HYV5Z1163655
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 12:34:31 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h78HYUDI021655
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 12:34:30 -0500 (CDT)
Received: (qmail 13959 invoked by uid 108); 8 Aug 2003 17:39:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9785 invoked from network); 8 Aug 2003 17:36:11 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308081730.h78HUc2W1138205@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 12:30:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] exam 3 topics (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 582
Content-Length: 495
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>1) I was wondering if we needed to know anything about flags in the ios class?

Topics for exam is inheritance and polymorphism.

>2) Can you explain and give an example of RTTI, good an dbad ways to use it.  Iam very confused on this topic.
>
>Thank You, 

This was discussed in the email yesterday. Please refer to it.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-587-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 12:34:38 2003
Return-Path: <uhcosc1320-return-587-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h78HYc5Z1155614
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 12:34:38 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h78HYcld024371
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 12:34:38 -0500 (CDT)
Received: (qmail 14155 invoked by uid 108); 8 Aug 2003 17:40:00 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8903 invoked from network); 8 Aug 2003 17:35:22 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308081729.h78HTlxL1167842@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 12:29:47 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: [uhcosc1320] Assign4--Question for the OverLoading Operator= (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 583
Content-Length: 1206
X-Keywords: $NotJunk                                                                                           

>Since we you want us to decide, is the correct to assume that one array can be initialized to another array if and only if the sizes are the same, else throw some kind of an exception.
>

You are using the word initialize. The size of one of the arrays
will not be known at this point then.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/08/03 12:06 AM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: Re: [uhcosc1320] Assign4--Question for the OverLoading Operator= (fwd)
>
>> 
>> >For assign4, will there be any assignment of one object to another
>(operator=), regardless of the type and array size?  I ask because you don't
>mention anything such on the instructions or on the test source.  
>
>Good question. I will let you make the decision on what to do about this.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-588-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 12:53:32 2003
Return-Path: <uhcosc1320-return-588-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h78HrW5Z1163956
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 12:53:32 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h78HrRld024957
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 12:53:31 -0500 (CDT)
Received: (qmail 1576 invoked by uid 108); 8 Aug 2003 17:58:54 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20053 invoked from network); 8 Aug 2003 17:45:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308081739.h78HdcgI1156218@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 12:39:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: [uhcosc1320] Assign4--Question for the OverLoading (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 584
Content-Length: 2071
X-Keywords: $NotJunk                                                                                           

>I actually made my ...<snip>

Hint, take a look at what is done in FiFo example we wrote in class.

Venkat

>
>
>On Fri, 2003-08-08 at 12:29, Dr. Venkat Subramaniam wrote:
>> >Since we you want us to decide, is the correct to assume that one array =
>can be initialized to another array if and only if the sizes are the same, =
>else throw some kind of an exception.
>> >
>>=20
>> You are using the word initialize. The size of one of the arrays
>> will not be known at this point then.
>>=20
>> Venkat
>>=20
>> >-------Original Message-------
>> >From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>> >Sent: 08/08/03 12:06 AM
>> >To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>> >Subject: Re: [uhcosc1320] Assign4--Question for the OverLoading Operator=
>=3D (fwd)
>> >
>> >>=20
>> >> >For assign4, will there be any assignment of one object to another
>> >(operator=3D), regardless of the type and array size?  I ask because you=
> don't
>> >mention anything such on the instructions or on the test source. =20
>> >
>> >Good question. I will let you make the decision on what to do about this=
>.
>> >
>> >Venkat Subramaniam
>> >--   	   	   	   =09
>> >cosc155g@bayou.uh.edu   	   	Department of Computer Science
>> >http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>> >77204-3475
>> >>=20
>> >
>>=20
>>=20
>>=20
>> Venkat Subramaniam
>> --			=09
>> cosc155g@bayou.uh.edu		Department of Computer Science
>> http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3=
>475
>
>--=-FI+hvw0d75Nmy8vVIT3F
>Content-Type: application/pgp-signature; name=signature.asc
>Content-Description: This is a digitally signed message part
>
>-----BEGIN PGP SIGNATURE-----
>Version: GnuPG v1.2.1 (GNU/Linux)
>
>iD8DBQA/M9+QPnDMJB7BohIRAm2eAKCZKC6oEzpQ85xYqbpuMQcFd1RLugCgldl6
>WQ+y5kgMKk13G38mwWru1Tc=
>=dFhU
>-----END PGP SIGNATURE-----
>
>--=-FI+hvw0d75Nmy8vVIT3F--
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-589-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 12:53:52 2003
Return-Path: <uhcosc1320-return-589-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h78Hrq5Z1501154
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 12:53:52 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h78HrpDI022080
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 12:53:51 -0500 (CDT)
Received: (qmail 2183 invoked by uid 108); 8 Aug 2003 17:59:19 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17908 invoked from network); 8 Aug 2003 17:43:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308081737.h78Hbava1165322@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 12:37:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question on ThingsToRemember (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 585
Content-Length: 577
X-Keywords: $NotJunk                                                                                           

>Can you please explain number 13th thing to Remeber,
>Do not modify the value of the default argument in the derived class.
>
>What default argument are we talking about here.
>
>Thanks

A code is worth a thousand words...  Try this one!

#include <iostream>
using namespace std;

class A
{
public:
	virtual void foo(int a = 4)
	{
		cout << "In A::foo with " << a << endl;
	}
};

class B : public A
{
public:
	virtual void foo(int a = 5)
	{
		cout << "In B::foo with " << a << endl;
	}
};

void f(A& obj)
{
	obj.foo();
}

void main()
{
	B object;
	object.foo();
	f(object);
}

From uhcosc1320-return-590-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 13:08:03 2003
Return-Path: <uhcosc1320-return-590-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h78I835Z1164734
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 13:08:03 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h78I82ld025396
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 13:08:02 -0500 (CDT)
Received: (qmail 16998 invoked by uid 108); 8 Aug 2003 18:13:25 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11162 invoked from network); 8 Aug 2003 18:07:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308081802.h78I2Hmp1162669@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 13:02:17 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Question on ThingsToRemember (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 586
Content-Length: 1123
X-Keywords: $NotJunk                                                                                           

>Perfect ...
>And consequences of modifying the value in the default argument in the 
>derived class are catastrophic.
>
>Thanks a lot.
>
>Best Regards

Yup. Each of the rules mentioned in there are critical ones (ok most of
them).

>>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>>To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
>>Subject: [uhcosc1320] Question on ThingsToRemember (fwd)
>>Date: Fri, 8 Aug 2003 12:37:36 -0500 (CDT)
>>
>> >Can you please explain number 13th thing to Remeber,
>> >Do not modify the value of the default argument in the derived class.
>> >
>> >What default argument are we talking about here.
>> >
>> >Thanks
>>
>>A code is worth a thousand words...  Try this one!
>>
>>#include <iostream>
>>using namespace std;
>>
>>class A
>>{
>>public:
>>	virtual void foo(int a = 4)
>>	{
>>		cout << "In A::foo with " << a << endl;
>>	}
>>};
>>
>>class B : public A
>>{
>>public:
>>	virtual void foo(int a = 5)
>>	{
>>		cout << "In B::foo with " << a << endl;
>>	}
>>};
>>
>>void f(A& obj)
>>{
>>	obj.foo();
>>}
>>
>>void main()
>>{
>>	B object;
>>	object.foo();
>>	f(object);
>>}

From uhcosc1320-return-591-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 13:22:22 2003
Return-Path: <uhcosc1320-return-591-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h78IMM5Z1159496
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 13:22:22 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h78IMLld025959
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 13:22:22 -0500 (CDT)
Received: (qmail 32486 invoked by uid 108); 8 Aug 2003 18:27:39 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17432 invoked from network); 8 Aug 2003 18:13:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308081808.h78I87cx1154365@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 13:08:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] midterm 3 1999 Question #1 about  LSP (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 587
Content-Length: 760
X-Keywords: $NotJunk                                                                                           

>class X {public:  virtual void f(); // f will return an even number
>};
>class Y : public X { public:  virtual void f(); // f will return either 3 or
>any even number
>};
>Are we in violation of any principles? If so, what are the consequences of
>this?
>
>We are violating LSP because in this case we can not substitute Y in place 
>of X without telling the user that he/she might be getting more than even 
>numbers, so now the user would have to change his/her code to fit the class, 
>which violates the basic concept of substitutablity and extensibility.
>
>Am I right???
>
>Thanks

Sounds good.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-592-cosc155g=bayou.uh.edu@agiledeveloper.com Fri Aug  8 13:23:44 2003
Return-Path: <uhcosc1320-return-592-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h78INi5Z1164135
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 13:23:44 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h78INiDI022963
	for <cosc155g@bayou.uh.edu>; Fri, 8 Aug 2003 13:23:44 -0500 (CDT)
Received: (qmail 1876 invoked by uid 108); 8 Aug 2003 18:29:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29778 invoked from network); 8 Aug 2003 18:25:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308081819.h78IJeT91162830@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Fri, 8 Aug 2003 13:19:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] VTable practice question (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 588
Content-Length: 996
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>Can you please check if the VTables for the following classes correct
>
>Thanks  a lot
>class Animal {
>public:
>	void eat() {
>                                 cout << "Animal Eats\n";
>                                 makeNoise();							}
>	virtual void makeNoise() { cout << "Animal makesNoice\n"; }
>};
>
>class Cat : public Animal { public:
>	virtual void eat() { cout << "Cat Eats\n"; } // Cat eat's quietly
>	virtual void sleepAllDay() { cout << "zzzzzzz scatch zzzzzz\n"; }
>};
>
>class Dog: public Animal { public:
>	void makeNoise() { cout << "Dog makesNoice\n";}
>	virtual void wagTheTail() { cout << "Wagwag\n"; };
>};
>
>VTable for animal
>Animal::makeNoise
>
>VTable for Cat
>Animal::makeNoise
>Cat::eat
>Cat::sleepAllDay
>
>VTable for Dog
>Dog::makeNoise
>Dog::wagTheTail
>
>
>Thanks
>Best Regards

Looks good.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-593-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 06:31:08 2003
Return-Path: <uhcosc1320-return-593-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79BV85Z1213603
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 06:31:08 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79BV8ld001369
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 06:31:08 -0500 (CDT)
Received: (qmail 13576 invoked by uid 108); 9 Aug 2003 11:36:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12499 invoked from network); 9 Aug 2003 11:34:40 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308091129.h79BT3xL1217397@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 06:29:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] MidTerm3 2003 (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 589
Content-Length: 397
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>  Would you tell me what is "DRY"?  It's the question #1 on MidTerm3 2003.
>
>Thanks,

It stands for 

Don't Repeat Yourself.

If you find yourself copying and pasting or simply rewriting a code
in more than one place, don't.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-594-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 06:43:27 2003
Return-Path: <uhcosc1320-return-594-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79BhR5Z1221737
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 06:43:27 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79BhRDI021122
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 06:43:27 -0500 (CDT)
Received: (qmail 20268 invoked by uid 108); 9 Aug 2003 11:48:55 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11895 invoked from network); 9 Aug 2003 11:33:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308091128.h79BS6Yv1218913@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 06:28:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Future programming prospects (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 590
Content-Length: 1090
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>
>While this may seem premature, I'd like to start playing around with
>win32 API programming... the console application seems rather dull, but
>that may be because I'm 'inexperienced'. In any case, is this a good
>idea? If so, what resources do you recommend for someone who has
>finished your course and is interested in playing around with basic
>win32 programs such as a file browser or a ... text editor? 
>
>Thanks =)

To get into windows programming in general, one could do VB programming
(aaahhhh), or use C++ and MFC (oh no) or go directly and use 
the C Win 32 API (hec no). Fortunately, we have the .NET framework
that is lot more respectable. You can program in C# (which looks a lot
like Java and C++). The most logical step, to program on the windows 
platform, is to pick up .NET and C#. To be fair, I have to mention
that there are other alternatives as well - like Delphi, Borland's 
products, etc.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-595-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 10:43:46 2003
Return-Path: <uhcosc1320-return-595-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79Fhk5Z1221503
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 10:43:46 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79FhjDI026036
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 10:43:45 -0500 (CDT)
Received: (qmail 578 invoked by uid 108); 9 Aug 2003 15:49:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32079 invoked from network); 9 Aug 2003 15:47:44 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308091542.h79Fg52O1172073@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 10:42:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Website down (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 591
Content-Length: 293
X-Keywords: $NotJunk                                                                                           

>Venkat:
>
>I am attempting to get assignment #4 but the website is down. Ideas?
>
>Thanx,

I just checked (10:40AM) and it is up now!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-596-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 11:49:42 2003
Return-Path: <uhcosc1320-return-596-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79Gng5Z1227915
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 11:49:42 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79Gnbld009825
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 11:49:42 -0500 (CDT)
Received: (qmail 8617 invoked by uid 108); 9 Aug 2003 16:55:10 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12801 invoked from network); 9 Aug 2003 16:09:08 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308091603.h79G3Ucw1429786@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 11:03:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] questions for assign4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 592
Content-Length: 628
X-Keywords: $NotJunk                                                                                           

>hi, venkat
>
>   I have some questions about the assign4.  
>1, Can I use "explicit" on the construtor?  Caz' I want my program avoids the unwanted promotion to an object of Stack.

I think that is reasonable.

>2, Can I use "inline" since the implementation and the interface are in the one file?

You could.

>3, Can I set my copy construtor ...<snip>

Please refer to previous emails on this one.

>Here is my stack.h file:  Would you take a look, please? 

I gave a cursory look at your code. I think you have made it 
a bit more complicated than it should be by using nested
classes. That is not really necessary.

Venkat

From uhcosc1320-return-597-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 11:53:36 2003
Return-Path: <uhcosc1320-return-597-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79Gra5Z1224975
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 11:53:36 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79GrZDI027435
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 11:53:35 -0500 (CDT)
Received: (qmail 11126 invoked by uid 108); 9 Aug 2003 16:59:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 442 invoked from network); 9 Aug 2003 16:42:24 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308091636.h79Gakxc1106426@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 11:36:46 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Using namespaces (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 593
Content-Length: 705
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>            
>            I do not understand why we have to use a namespace in assignment 4 .

Because I insist on it use in this assignment. Thats it.

> Maybe I do not understand the concept of using namespaces. Could you explain a little? Thanks for your time.

Namespaces give a context (or home) within which class names are 
defined. This eliminates problem in a large scale system where
more than one class may represent differrent concepts, but
may have the same name. The namespace eliminates the name collision
of classes.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-598-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 16:58:43 2003
Return-Path: <uhcosc1320-return-598-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79Lwh5Z1233251
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 16:58:43 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79LwgDI004314
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 16:58:43 -0500 (CDT)
Received: (qmail 14495 invoked by uid 108); 9 Aug 2003 22:04:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1254 invoked from network); 9 Aug 2003 16:43:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308091637.h79GbplI1223988@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 11:37:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Future programming prospects (fwd)
X-Spam-Status: No, hits=-1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 594
Content-Length: 1358
X-Keywords: $NotJunk                                                                                           

And wxwindows, which is cross platform.  You can program code for the
wxwindows graphics library, and port it to unix and windows easily.

Or SDL.

Or GTK+.


On Sat, 2003-08-09 at 06:28, Dr. Venkat Subramaniam wrote:
> >Hi Venkat,
> >
> >
> >While this may seem premature, I'd like to start playing around with
> >win32 API programming... the console application seems rather dull, but
> >that may be because I'm 'inexperienced'. In any case, is this a good
> >idea? If so, what resources do you recommend for someone who has
> >finished your course and is interested in playing around with basic
> >win32 programs such as a file browser or a ... text editor? 
> >
> >Thanks =)
> 
> To get into windows programming in general, one could do VB programming
> (aaahhhh), or use C++ and MFC (oh no) or go directly and use 
> the C Win 32 API (hec no). Fortunately, we have the .NET framework
> that is lot more respectable. You can program in C# (which looks a lot
> like Java and C++). The most logical step, to program on the windows 
> platform, is to pick up .NET and C#. To be fair, I have to mention
> that there are other alternatives as well - like Delphi, Borland's 
> products, etc.
> 
> Venkat Subramaniam
> --				
> cosc155g@bayou.uh.edu		Department of Computer Science
> http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-599-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 17:20:59 2003
Return-Path: <uhcosc1320-return-599-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79MKw5Z1235307
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 17:20:58 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79MKwDI004870
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 17:20:58 -0500 (CDT)
Received: (qmail 28931 invoked by uid 108); 9 Aug 2003 22:26:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26527 invoked from network); 9 Aug 2003 22:22:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308092217.h79MH7Gh1217060@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 17:17:07 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 4 Test Conditions (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 595
Content-Length: 450
X-Keywords: $NotJunk                                                                                           

>Venkat,
>Are there going to be any other test conditions for assignment 4 that we
>should be aware of?  I just want to make sure that my code can handle
>whatever is thrown at it.  Please let us know.  Thanks

Just like how the other assignments were put to test, this one will 
be as well.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-600-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 17:25:05 2003
Return-Path: <uhcosc1320-return-600-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79MP55Z1235893
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 17:25:05 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79MP4ld019146
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 17:25:04 -0500 (CDT)
Received: (qmail 31802 invoked by uid 108); 9 Aug 2003 22:30:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25578 invoked from network); 9 Aug 2003 22:21:17 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308092215.h79MFbOa1243888@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 17:15:37 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Future programming prospects (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 596
Content-Length: 1993
X-Keywords: $NotJunk                                                                                           

I suggest you start your search at one of the online book stores
like Amazon for books and at Google for online resources.

Venkat

>Hmmm, are there any good online sources or REAL books to start out with?
>
>-----Original Message-----
>From: Dr. Venkat Subramaniam [mailto:cosc155g@Bayou.UH.EDU] 
>Sent: Saturday, August 09, 2003 11:38 AM
>To: COSC 1320 Mailing List
>Subject: Re: [uhcosc1320] Future programming prospects (fwd)
>
>And wxwindows, which is cross platform.  You can program code for the
>wxwindows graphics library, and port it to unix and windows easily.
>
>Or SDL.
>
>Or GTK+.
>
>
>On Sat, 2003-08-09 at 06:28, Dr. Venkat Subramaniam wrote:
>> >Hi Venkat,
>> >
>> >
>> >While this may seem premature, I'd like to start playing around with
>> >win32 API programming... the console application seems rather dull,
>but
>> >that may be because I'm 'inexperienced'. In any case, is this a good
>> >idea? If so, what resources do you recommend for someone who has
>> >finished your course and is interested in playing around with basic
>> >win32 programs such as a file browser or a ... text editor? 
>> >
>> >Thanks =)
>> 
>> To get into windows programming in general, one could do VB
>programming
>> (aaahhhh), or use C++ and MFC (oh no) or go directly and use 
>> the C Win 32 API (hec no). Fortunately, we have the .NET framework
>> that is lot more respectable. You can program in C# (which looks a lot
>> like Java and C++). The most logical step, to program on the windows 
>> platform, is to pick up .NET and C#. To be fair, I have to mention
>> that there are other alternatives as well - like Delphi, Borland's 
>> products, etc.
>> 
>> Venkat Subramaniam
>> --				
>> cosc155g@bayou.uh.edu		Department of Computer Science
>> http://www.cs.uh.edu/~svenkat 	University of Houston, Houston,
>Tx 77204-3475
>
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-601-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 17:33:38 2003
Return-Path: <uhcosc1320-return-601-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79MXc5Z1149428
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 17:33:38 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79MXcld019384
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 17:33:38 -0500 (CDT)
Received: (qmail 4771 invoked by uid 108); 9 Aug 2003 22:39:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27897 invoked from network); 9 Aug 2003 22:25:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308092219.h79MJN9A1241009@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 17:19:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 4 (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 597
Content-Length: 808
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>
>       Sorry to bother again but i wanted to know which is the best way to 
>use namespace
>
>If I put 
>
>using namespace StackExceptions; 
>
>in the Stack.h file i don't need to write 
>
>throw StackExceptions::StackFull(int size);    i can just write throw 
>StackFull(int size)
>
>       Which is a better program practice to use. Can you please advice on 
>this
>Thank You

Generally speaking, I put the using if it will mimimize the amount
of code to write in two or more places. If I have to use the full
name in just a few places (one or two), I usually do not bother
to put the using. But, that is just my personal preference.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-602-cosc155g=bayou.uh.edu@agiledeveloper.com Sat Aug  9 18:13:10 2003
Return-Path: <uhcosc1320-return-602-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h79NDA5Z1243965
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 18:13:10 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h79ND9DI005731
	for <cosc155g@bayou.uh.edu>; Sat, 9 Aug 2003 18:13:09 -0500 (CDT)
Received: (qmail 29734 invoked by uid 108); 9 Aug 2003 23:18:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 600 invoked from network); 9 Aug 2003 22:32:16 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308092226.h79MQaHu1240830@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sat, 9 Aug 2003 17:26:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Delete causing error (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 598
Content-Length: 541
X-Keywords:                                                                                                    

> Hello Venkat,
>Im practically finished with the program(i have to implement copy contructor and assignment operator). But the lsat line of the output doesnt execute. Now when i removed the delete[]stackPtr from the destructor it worked fine. How do i go about solving this, as I am confused why this would happen. I'm attaching my program as  a .zip file.
>Thanks

Here is what your code has:

*stackPtr++=a;

This is trouble waiting to happen (and fortunately for you, it did).

It should be 

stackPtr[location] = a;
location++;

Venkat

From uhcosc1320-return-603-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 09:05:25 2003
Return-Path: <uhcosc1320-return-603-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AE5N5Z1277582
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:05:23 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AE5Mld022931
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:05:22 -0500 (CDT)
Received: (qmail 9219 invoked by uid 108); 10 Aug 2003 14:10:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4226 invoked from network); 10 Aug 2003 14:02:17 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101356.h7ADuYaL1279787@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 08:56:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: Re: [uhcosc1320] Assign4--Question for the OverLoading Operator= (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 599
Content-Length: 2168
X-Keywords: $NotJunk                                                                                           

>Let me rephrase it.  Can we find the reference's array size and make an array of size equal to the reference, and then copy the elements?  

Yes, you could.

>Also, can you explain why in your FiFo example dated 8/7/03  why do you have the copy constructor protected and not public like we normally do?  Thanks.

You may read the article "Why Copying an Object is a terrible thing
to do?" at http://www.agiledeveloper.com/download.aspx.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/08/03 12:29 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: Re: Re: [uhcosc1320] Assign4--Question for the OverLoading Operator= (fwd)
>
>> 
>> >Since we you want us to decide, is the correct to assume that one array
>can be initialized to another array if and only if the sizes are the same,
>else throw some kind of an exception.
>>
>
>You are using the word initialize. The size of one of the arrays
>will not be known at this point then.
>
>Venkat
>
>>-------Original Message-------
>>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>>Sent: 08/08/03 12:06 AM
>>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>>Subject: Re: [uhcosc1320] Assign4--Question for the OverLoading Operator= 
>(fwd)
>>
>>> 
>>> >For assign4, will there be any assignment of one object to another
>>(operator=), regardless of the type and array size?  I ask because you
>don't
>>mention anything such on the instructions or on the test source.  
>>
>>Good question. I will let you make the decision on what to do about this.
>>
>>Venkat Subramaniam
>>--      	      	      	      	
>>cosc155g@bayou.uh.edu      	      	Department of Computer Science
>>http://www.cs.uh.edu/~svenkat       	University of Houston, Houston, Tx
>>77204-3475
>>> 
>>
>
>
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-604-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 09:08:04 2003
Return-Path: <uhcosc1320-return-604-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AE845Z1492360
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:08:04 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AE80ld023019
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:08:03 -0500 (CDT)
Received: (qmail 10806 invoked by uid 108); 10 Aug 2003 14:13:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7839 invoked from network); 10 Aug 2003 14:08:45 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101403.h7AE33BL1277280@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 09:03:03 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question about Exception classes (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 600
Content-Length: 941
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>
>I am really confused about two things, what we need in the Exception classes 
>and the namespace
>
>I wrote the following code for the Exception classes can you please check if 
>I am on the right track. I haven't tried to compile the code yet because I 
>don't know how to compile a program with two different classes in bayou. If 
>you can tell me that too that would be perfect.
>
>here is my code:

I have not looked at your code. No point looking at a code that is
not compiled. Here is how you compile several classes at a time.

cxx -o assign4 *.cpp

This will grab all the .cpp files in the current directory and compile
them into the assign4 exectable.

You can also give individual .cpp files instead of *.cpp as in

cxx -o assign4 assign4.cpp Exceptions.cpp

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-605-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 09:11:07 2003
Return-Path: <uhcosc1320-return-605-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AEB65Z1280073
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:11:06 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AEB0ld023105
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:11:01 -0500 (CDT)
Received: (qmail 12759 invoked by uid 108); 10 Aug 2003 14:16:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2836 invoked from network); 10 Aug 2003 14:00:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101354.h7ADsIvg1269446@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 08:54:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 4: namespace (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 601
Content-Length: 823
X-Keywords: $NotJunk                                                                                           

>Hi Dr. Venkat
>
>I am having trouble with assignment 4. I am not sure
>if I am using namespace correctlly. I was wondering if
>you can take a look at it. I have attached
>Exceptions.h and Exceptions.cpp.  I am getting this
>errors when I compile:
>
>error C2882: 'StackExceptions' : illegal use of
>namespace identifier in expression
>
>error C2039: 'StackEmpty' : is not a member of
>'`global namespace''
>
>syntax error : missing ';' before identifier
>'StackEmpty'
>
>syntax error : missing ';' before identifier
>'StackEmpty'.
>
>It basically does not recognize my classes define in
>namespace.

You have attached Exception.h and Exception.cpp. 
I reviewed those and even compiled with those and
there is no problem. The problem may be in your
Stack.h file. If you send me that, I may be able to
help further.

Venkat

From uhcosc1320-return-606-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 09:21:23 2003
Return-Path: <uhcosc1320-return-606-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AELM5Z1265912
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:21:22 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AELLld023387
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:21:21 -0500 (CDT)
Received: (qmail 18431 invoked by uid 108); 10 Aug 2003 14:26:57 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6409 invoked from network); 10 Aug 2003 14:06:11 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101400.h7AE0S3u1273595@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 09:00:28 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Question about Templates and implementations (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 602
Content-Length: 994
X-Keywords: $NotJunk                                                                                           

>I was wondering in class you said that when we are writing a template we 
>need to have the implementations within the interface. But in our 
>assignments we have the class first and then the implementations so how do 
>we make it a template

No, I did not say that. I said the implementation should be visible
for the template instantiation to take place. So, we put it in the
header (not within the class, but just in the header itself as agains
.cpp file).

>For example lets say that you have the following code:
>
>template <class MEMBER>
>class A
>{
>public:
> A(int a);
<snip>
>};
>

<snip>
>A::A(int a)
>{
<snip>
>...}
>
<snip>
>
>is the this code okay for a template or do we need implementations the way 
>it was in FiFo.h
>
>Thanks

That looks good as long as you put the class and its implementation 
in the header itself.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-607-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 09:22:57 2003
Return-Path: <uhcosc1320-return-607-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AEMu5Z1245387
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:22:56 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AEMuDI028351
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 09:22:56 -0500 (CDT)
Received: (qmail 19416 invoked by uid 108); 10 Aug 2003 14:28:27 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4935 invoked from network); 10 Aug 2003 14:03:30 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101357.h7ADvjPS1276195@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 08:57:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] due date for assign4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 603
Content-Length: 449
X-Keywords: $NotJunk                                                                                           

>Is the due date for assignment 4 Tuesday, August 12 by 11:59pm?  I guess I thought you said it was due by Monday, August 11 by 11:59pm?  Can you confirm the due date for assign4?  thanks.

I mentioned in the class that it is due midnight of the night that is between
Tuesday and Wednesday!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-608-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 10:45:57 2003
Return-Path: <uhcosc1320-return-608-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AFjv5Z1268699
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 10:45:57 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AFjuld025750
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 10:45:56 -0500 (CDT)
Received: (qmail 3132 invoked by uid 108); 10 Aug 2003 15:51:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2441 invoked from network); 10 Aug 2003 15:50:29 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101544.h7AFikeZ1274545@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 10:44:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] COSC 1320 assignment4 questions (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 604
Content-Length: 874
X-Keywords: $NotJunk                                                                                           

>Hello Venkat, I need to see about confirming a few things for assignment#4.  
>Please answer all of the following.
>
>1.  Can we assume that you will test our program using an int value for the 
>size of our stack with value between 0 - max int size(65535)? If not, I 
>would have to use long int or throw an exception in the constructor.

Yes, you can assume this. I will actually test with a value greater than 0
but less than the max size of int.

>2. Also, can we assume that you will create stack objects in the test file 
>of type int, float, double?

And other types as well.

>3. Will you create a stack object with type class where the stack will push 
>and pop objects of that class?

Yes.

>
>Thank you,

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-609-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 12:55:19 2003
Return-Path: <uhcosc1320-return-609-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AHtJ5Z1286979
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 12:55:19 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AHtIDI002705
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 12:55:18 -0500 (CDT)
Received: (qmail 17476 invoked by uid 108); 10 Aug 2003 18:00:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16615 invoked from network); 10 Aug 2003 17:59:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101753.h7AHrrwI1284536@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 12:53:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Float warning (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 605
Content-Length: 743
X-Keywords: $NotJunk                                                                                           

>Hello Venkat, 
>i was experimenting with different types like char etc. When i modify the main for char(I hope its right)
>
>Stack<char> stk(5);
>
>		stk.push('a');
>		stk.push('b');
>it runs fine, but when i make it float like this 
>Stack<float> stk(5);
>
>		stk.push(1.23);
>		stk.push(4.56);
>
>I get this warning :--    argument' : truncation from 'const double' to 'const float'
>
>how do i go about fixing this
>
>thanks

The compiler is considering 1.23 as a double instead of float.
You can ignore float and simply work with double and that will
be fine for this assignment.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-610-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 14:44:12 2003
Return-Path: <uhcosc1320-return-610-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AJiC5Z1284729
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 14:44:12 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AJiBld002036
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 14:44:11 -0500 (CDT)
Received: (qmail 24075 invoked by uid 108); 10 Aug 2003 19:49:49 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22382 invoked from network); 10 Aug 2003 19:46:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101941.h7AJf88r1277241@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 14:41:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] COSC 1320 assignment4 questions (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 606
Content-Length: 2707
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>    Will you please be more specific about creating a stack object of type 
>class and pushing and popping objects of that class? For instance, will you 
>give us the private member variables to output or will you create an output 
>function?
>
>As in the example assign4.cpp file
>
>cout << stk.pop << endl;
>
>Pop is to return the popped off element and cout is to output the popped 
>object to the screen. If you create a stack object of say
>
>class Car
>{ public:
>      ...
>  private:
>     char * name;
>     int miles_per_gallon;
>};
>
>We're going to have to know the private member variables' names and type so 
>when we return the object of type Car, we will have to overload cout to 
>output the object of type Car private member variables correctly.

This would never be the responsiblity of a stack, will it.
All that a stack has to do is manage the elements. What a user of
the elements does with the element after it is poped is up to the user.

>This same problem is for overloaded operator= and overloaded operator== .
>
>Please explain in detail so I know exactly what you want for this 
>assignment# 4.
>
>:)
>
>//////////////////////////////////////////////
>>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>>To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
>>Subject: [uhcosc1320] COSC 1320 assignment4 questions (fwd)
>>Date: Sun, 10 Aug 2003 10:44:45 -0500 (CDT)
>>
>> >Hello Venkat, I need to see about confirming a few things for 
>>assignment#4.
>> >Please answer all of the following.
>> >
>> >1.  Can we assume that you will test our program using an int value for 
>>the
>> >size of our stack with value between 0 - max int size(65535)? If not, I
>> >would have to use long int or throw an exception in the constructor.
>>
>>Yes, you can assume this. I will actually test with a value greater than 0
>>but less than the max size of int.
>>
>> >2. Also, can we assume that you will create stack objects in the test 
>>file
>> >of type int, float, double?
>>
>>And other types as well.
>>
>> >3. Will you create a stack object with type class where the stack will 
>>push
>> >and pop objects of that class?
>>
>>Yes.
>>
>> >
>> >Thank you,
>>
>>Venkat Subramaniam
>>--
>>cosc155g@bayou.uh.edu		Department of Computer Science
>>http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 
>>77204-3475
>
>_________________________________________________________________
>MSN 8 with e-mail virus protection service: 2 months FREE*  
>http://join.msn.com/?page=features/virus
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-611-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 15:00:07 2003
Return-Path: <uhcosc1320-return-611-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AK075Z1289891
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 15:00:07 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AK06DI005531
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 15:00:06 -0500 (CDT)
Received: (qmail 987 invoked by uid 108); 10 Aug 2003 20:05:44 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21221 invoked from network); 10 Aug 2003 19:44:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101939.h7AJdBVp1287162@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 14:39:11 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] HW4- Question???? (fwd)
X-Spam-Status: No, hits=0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 607
Content-Length: 706
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
> 
>I got a 7 on my hw 4 i was just wondering what i missed because I thought it was rather simple i was just wondering what i did wrong could you please tell me, or let me know when you are available to talk about it. thanx.

Here is an exerpt from the grades web site repeated here for your convenience:

"Please read this carefully. Do not send any emails to Venkat about grading 
issues. Talk to him during his office hours. To find out his office hours, 
please visit http://www.cs.uh.edu/~svenkat. Click here to view your grades."

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-612-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 15:00:15 2003
Return-Path: <uhcosc1320-return-612-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AK0E5Z1282918
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 15:00:14 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AK0EDI005538
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 15:00:14 -0500 (CDT)
Received: (qmail 1150 invoked by uid 108); 10 Aug 2003 20:05:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20205 invoked from network); 10 Aug 2003 19:43:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308101937.h7AJbJnF1283155@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 14:37:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 4: Extensibility... (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 608
Content-Length: 701
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>I know that we are not using polymorphism in assignment 4, but should we make our methods virtual so that it can be extensible? In other words, would we be penalized if we did not make them virtual seeing that we're not using polymorphism.
>
>Thanks for your time.

Good question. Any time you write a class you need to ask yourself.
If some one inherits from my class, will it work correctly.
You need to write your class so that it is either possible and
works correctly, or no one should be able to derived from your class.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-613-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 18:02:55 2003
Return-Path: <uhcosc1320-return-613-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AN2t5Z1296107
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:02:55 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AN2tld007370
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:02:55 -0500 (CDT)
Received: (qmail 13960 invoked by uid 108); 10 Aug 2003 23:08:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12692 invoked from network); 10 Aug 2003 23:06:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308102300.h7AN0mTm1300059@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 18:00:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] size function for assignment4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 609
Content-Length: 579
X-Keywords: $NotJunk                                                                                           

>For my catch in the main when it trys to read the maxsize of the array, I get an error stating: error C2039: 'size' : is not a member of 'StackFull'  
>I don't understand why I'm gettting this error when I have the excetptions classes part of the Stack class.  I know the following is not complete, but can you see why I am getting this error message.  THanks.
>

>From the assign4.cpp you can see that 

ex.size() is called from within the catch blow.

This expect the StackFull class to have a method called size.

Does your StackFull class have a method called size?

Venkat

From uhcosc1320-return-614-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 18:04:56 2003
Return-Path: <uhcosc1320-return-614-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AN4u5Z1280126
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:04:56 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AN4uld007431
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:04:56 -0500 (CDT)
Received: (qmail 15242 invoked by uid 108); 10 Aug 2003 23:10:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10865 invoked from network); 10 Aug 2003 23:03:22 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308102257.h7AMvcqG1294099@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 17:57:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: Re: [uhcosc1320] Assign4--Question for the OverLoading Operator= (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 610
Content-Length: 479
X-Keywords: $NotJunk                                                                                           

>Hi Venakt,
>
>About the operator =, is it also okay to take cue from the FIFO example and ...deleted...
>Thanks Alot

I will be leaving this topic for your descretion. I want you to put your
foot down and make up your mind on this one. Enough has been said about
this and you can refer to previous emails on this topic.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-615-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 18:07:32 2003
Return-Path: <uhcosc1320-return-615-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7AN7W5Z1284772
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:07:32 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7AN7Vld007525
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:07:31 -0500 (CDT)
Received: (qmail 17028 invoked by uid 108); 10 Aug 2003 23:13:07 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11521 invoked from network); 10 Aug 2003 23:04:24 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308102258.h7AMwe2d1277692@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 17:58:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] linking error (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 611
Content-Length: 672
X-Keywords: $NotJunk                                                                                           

>main.obj : error LNK2001: unresolved external symbol "public: int __thiscall StackExceptions::StackFull::size(void)const " (?size@StackFull@StackExceptions@@QBEHXZ)
>main.obj : error LNK2001: unresolved external symbol "public: __thiscall StackExceptions::StackFull::StackFull(int)" (??0StackFull@StackExceptions@@QAE@H@Z)
>Debug/main.exe : fatal error LNK1120: 2 unresolved externals
> 
>I have these linking errors and I'm not sure what they mean.
> 
>I also know I have a mem leak, but I doubt that has anything to do with it.
> 
>Any help would be ...helpful.  Thanks in advance.

Make sure that Exceptions.cpp has been added to the project for
compilation. 

Venkat

From uhcosc1320-return-616-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 18:10:56 2003
Return-Path: <uhcosc1320-return-616-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7ANAu5Z1264188
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:10:56 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7ANAuDI009492
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:10:56 -0500 (CDT)
Received: (qmail 19475 invoked by uid 108); 10 Aug 2003 23:16:34 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8791 invoked from network); 10 Aug 2003 23:00:03 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308102254.h7AMsJOX1283396@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 17:54:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Question about Templates and implementations (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 612
Content-Length: 1455
X-Keywords:                                                                                                    

>Hi Venkat
>
>Here is a minor example that I wrote that is giving me the same errors as my 
>Stack template
>
>template <class M>
>class A
>{
>  public:
>    A(M v);
>    ~A();
>    M foo(M a);
>  private:
>    M val;
>};
>
>A::A(M v)

This should be written as 

template <class M>
A<M>::A(M v)

>...deleted...
>
>It gives me the following errors,
>
>Where am I wrong
>cxx: Error: class.h, line 12: argument list for class template "A" is 
>missing
>A::A(M v)
>^
>cxx: Error: class.h, line 12: this declaration has no storage class or type
>          specifier
>A::A(M v)
>^
>cxx: Error: class.h, line 12: identifier "M" is undefined
>A::A(M v)
>-----^
>cxx: Error: class.h, line 12: expected a ")"
>A::A(M v)
>-------^
>cxx: Error: class.h, line 13: expected a ";"
>{
>^
>cxx: Warning: main.cpp, line 14: parsing restarts here after previous syntax
>          error
>}
>^
>
>And when I exclude A:: from the implementations it gives me following errors
>cxx: Error: class.h, line 12: argument list for class template "A" is 
>missing
>A(M v)
>^
>cxx: Error: class.h, line 12: expected a ")"
>A(M v)
>----^
>cxx: Error: class.h, line 13: expected a ";"
>{
>^
>cxx: Warning: main.cpp, line 14: parsing restarts here after previous syntax
>          error
>}
>^
>
>Pleeeeeeeeeeeaaaaaaaaaaseeeeeeeeee help
>thanks

When you implement a method that belongs to a template, here is how
you write it


template<class M>
A<M>::A(.......

Hope this helps.

Venkat

From uhcosc1320-return-617-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 18:23:12 2003
Return-Path: <uhcosc1320-return-617-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7ANNB5Z1270260
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:23:11 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7ANNBld007956
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 18:23:11 -0500 (CDT)
Received: (qmail 26976 invoked by uid 108); 10 Aug 2003 23:28:44 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10114 invoked from network); 10 Aug 2003 23:02:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308102256.h7AMuF2W1148048@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 17:56:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] help on using namespace (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 613
Content-Length: 1548
X-Keywords: $NotJunk                                                                                           

>hi Venkat,
>
>Could you please tell me what I am doing wrong.  So far, my code
>compiles, and works fine.  The problem is when using the exception
>classes.
>
>StackEmpty class gives me no problem, because no function is implemented
>in it.  But the StackFull is the one that I'm having problems with, here
>is my code of the implementation of this two classes in same namespace.
>
># include "Stack.h"
>
>namespace StackExceptions : public Stack

What that! Do not inherit your namespace from any thing.
Simply write it as 

namespace StackExceptions 

>...deleted...
>
>This is the error that I get, What I want ot do is inherint fokrm Stack
>then acces the method that that gives me the size of the Stack.
>
>
>
>ompiling...
>main.cpp
>c:\c++\stack\stack.h(1) : warning C4182: #include nesting level is 363
>deep; possible infinite recursion
>c:\c++\stack\stack.h(1) : fatal error C1076: compiler limit : internal
>heap limit reached; use /Zm to specify a higher limit
>Exceptions.cpp
>c:\c++\stack\exceptions.h(1) : warning C4182: #include nesting level is
>363 deep; possible infinite recursion
>c:\c++\stack\exceptions.h(1) : fatal error C1076: compiler limit :
>internal heap limit reached; use /Zm to specify a higher limit
>Error executing cl.exe.
>
>main.exe - 2 error(s), 2 warning(s)
>
>Thank you Venkat for all the extra work that you do to assists us.

You are most welcome.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-618-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 19:38:12 2003
Return-Path: <uhcosc1320-return-618-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B0cC5Z1297886
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 19:38:12 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B0cBDI011064
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 19:38:12 -0500 (CDT)
Received: (qmail 7668 invoked by uid 108); 11 Aug 2003 00:43:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6954 invoked from network); 11 Aug 2003 00:42:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110037.h7B0b1xr1299813@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 19:37:01 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assign 4 - Errors in Stack.h (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 614
Content-Length: 1358
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>I compiled my code and get 102 errors; 100 of them are
>exactly the same....I have no idea what I'm doing
>wrong.
>
>Compiling...
>assign4.cpp
>d:\curly\cosc1320\assign4\assign4\stack.h(36) : error
>C2065: 'MEMBER' : undeclared identifier
>d:\curly\cosc1320\assign4\assign4\stack.h(36) : error
>C2955: 'Stack' : use of class template requires
>template argument list
>        d:\curly\cosc1320\assign4\assign4\stack.h(28)
>: see declaration of 'Stack'
>d:\curly\cosc1320\assign4\assign4\stack.h(40) : error
>C2061: syntax error : identifier 'MEMBER'
>d:\curly\cosc1320\assign4\assign4\stack.h(42) : error
>C2143: syntax error : missing ';' before '}'
>d:\curly\cosc1320\assign4\assign4\stack.h(42) : error
>C2143: syntax error : missing ';' before '}'
>.
>.
>.(about 98 more of these)
>
>I've attached my files, PLEASE take a look at them and
>see if I'm on the right track. Thanks, I really
>appreciate your time. 
>

There was an email about this a few hours ago.
I explained the format you need to use for the
implementation. Please visit
http://www.cs.uh.edu/~svenkat/summer2003/mailstoclass
and look for
"When you implement a method that belongs to a template"
without the quote.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-619-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 19:38:46 2003
Return-Path: <uhcosc1320-return-619-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B0ck5Z1297168
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 19:38:46 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B0cjld010020
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 19:38:45 -0500 (CDT)
Received: (qmail 8094 invoked by uid 108); 11 Aug 2003 00:44:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5115 invoked from network); 11 Aug 2003 00:39:44 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110033.h7B0XxQE1295404@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 19:33:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Don't worry, NOT about Grades but about OFFICE HOURS (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 615
Content-Length: 1029
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>I just wanted to ask you if you were going to be in
>your office on Monday before 4:00pm because I would be
>at UH during that time. (Your office hours say
>5:30-6pm) It would be inconvenient for me to wait at
>UH for an hour and a half because I live about 1 hour
>away from UH. Please email me back as soon as possible
>and let me know what time you would be in your office
>earlier because I would like to talk to you about my
>grades. Thank you very much for your time, I really
>appreciate it. =)

My summer office hours are over. Please visit my web site
at http://www.cs.uh.edu/~svenkat for details on my
Fall office hours. I will be glad to talk about your
grades during my office hours or by appointment after
August 25th. If there is a mistake in grading, that
can be fixed and there is plenty of time for that. 
So, there is no hurry at all. :)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-620-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 19:50:21 2003
Return-Path: <uhcosc1320-return-620-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B0oL5Z1300488
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 19:50:21 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B0oKld010345
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 19:50:20 -0500 (CDT)
Received: (qmail 14985 invoked by uid 108); 11 Aug 2003 00:55:59 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9269 invoked from network); 11 Aug 2003 00:46:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110040.h7B0eKa41292493@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 19:40:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Midterm #3 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 616
Content-Length: 439
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I was just wondering when would be the best time to come by and look at my midterm #3.  Please let me know as soon as possible.  Thanks.
>

During my office hours or by appointment after August 25th.
Please visit my web site given below for details on my office hours.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-621-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 19:55:26 2003
Return-Path: <uhcosc1320-return-621-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B0tQ5Z1302544
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 19:55:26 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B0tQDI011433
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 19:55:26 -0500 (CDT)
Received: (qmail 18066 invoked by uid 108); 11 Aug 2003 01:01:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13987 invoked from network); 11 Aug 2003 00:54:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110048.h7B0mU2J1305893@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 19:48:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Code review
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 617
Content-Length: 1516
X-Keywords: $NotJunk                                                                                           

>Alright, I got the code to work.
>
>Now, could you give me some hints on how to improve the given code that is attached (besides the fact that it is one file).
>
>Is inheritance really necessary? I got the sample to work just fine w/o it (not that really means anything).
>
>Thanks in advance for helping me out.
>

I have mentioned a few things here in general terms so every one could
benefit.

1. Do not use iostream.h. Use iostream instead.
2. See if each member variable in your Stack is abolutely necessary.
	For example, there is no need to keep track of the count
	and have a bottom of list as well.
3. If you implement a copy constructor, make sure its implementation is correct.
4. If you implement operator=, make sure its implementation is correct.
5. No need to create an exception object unless you are goint to
	throw it. In other words, create the exception object only in
	the flow of control that will throw. Do not create the object
	if exception will not be thrown in the flow of control.
6. Do not print any thing from your Stack class. In other words, 
	you should not output any thing using cout. 
7. Visit and check if you have followed all the dos and don't of C++. 
8. Test your code by creating your own class (say Person or Car)
	and see how the Stack works with UDTs (user defined data types, 
	that is).
9. Review your code by reading each line and thinking about what it does.
	This is one of the best way to eliminate errors once you think
	you are done.
10. Check for memory leaks.

From uhcosc1320-return-622-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 20:48:34 2003
Return-Path: <uhcosc1320-return-622-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B1mY5Z1178200
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 20:48:34 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B1mXld012208
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 20:48:33 -0500 (CDT)
Received: (qmail 17003 invoked by uid 108); 11 Aug 2003 01:54:13 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16143 invoked from network); 11 Aug 2003 01:53:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110147.h7B1lGdr1265323@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 20:47:16 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] size function for assignment4 (fwd)
X-Spam-Status: No, hits=0.4 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 618
Content-Length: 1406
X-Keywords: $NotJunk                                                                                           

>Regarding the size function in StackFull, if I inherate it from the Stack class, can't it call the size function I have in my Stack function?  Can you explain.  Since StackFull won't call the size in Stack, do you see any point in having it inherate from Stack?   Thanks.

Remember what inheritance means. It leads to substituitability.
By inheriting you are saying an object of derived is also
an object of base. By inheriting exception class StackFull from Stack,
you are saying it is a Stack as well. Does it make sense to inherit 
StackFull from Stack?

Venkat

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/10/03 04:00 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] size function for assignment4 (fwd)
>
>> 
>> >For my catch in the main when it trys to read the maxsize of the array, I
>get an error stating: error C2039: 'size' : is not a member of 'StackFull'  
>
>>I don't understand why I'm gettting this error when I have the
>excetptions classes part of the Stack class.  I know the following is not complete,
>but can you see why I am getting this error message.  THanks.
>>
>
>>From the assign4.cpp you can see that 
>
>ex.size() is called from within the catch blow.
>
>This expect the StackFull class to have a method called size.
>
>Does your StackFull class have a method called size?
>
>Venkat

From uhcosc1320-return-623-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 21:12:46 2003
Return-Path: <uhcosc1320-return-623-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B2Cj5Z1291689
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 21:12:45 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B2CjDI013275
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 21:12:45 -0500 (CDT)
Received: (qmail 32022 invoked by uid 108); 11 Aug 2003 02:18:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30511 invoked from network); 11 Aug 2003 02:16:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110210.h7B2AYmC1293413@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 21:10:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] namespace question (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 619
Content-Length: 655
X-Keywords: $NotJunk                                                                                           

>When I have the namespace code in my Stack.h file:
>namespace StackExceptions{
>	class StackEmpty{};
>	class StackFull{};
>}
>
>when I run the code, it says that method size is not a member of the StackEmpty class.  And then it says see declaration and it takes me directly to the above code instead of the Exception.h or .cpp file.  And so, I have to implement the size function here in the namespace.  Can you explain why this is so?  Thanks.

The size function is a method of StackFull class!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-624-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 21:15:06 2003
Return-Path: <uhcosc1320-return-624-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B2F65Z1303987
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 21:15:06 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B2F5DI013356
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 21:15:06 -0500 (CDT)
Received: (qmail 1096 invoked by uid 108); 11 Aug 2003 02:20:45 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29572 invoked from network); 11 Aug 2003 02:14:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110208.h7B28paW1305144@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 21:08:51 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] help on using namespace (fwd)
X-Spam-Status: No, hits=0.4 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 620
Content-Length: 2353
X-Keywords: $NotJunk                                                                                           

>If we write the namespace as you suggested: namespace StackExceptions.....how will it inherit the size function from our Stack class?  Thanks.

It will not. Within your StackFull class, you write a size function from
scatch. It has nothing to do with the Stack class except the Stack
object throws this kind of exception.

Venkat

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/10/03 03:56 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] help on using namespace (fwd)
>
>> 
>> >hi Venkat,
>>
>>Could you please tell me what I am doing wrong.  So far, my code
>>compiles, and works fine.  The problem is when using the exception
>>classes.
>>
>>StackEmpty class gives me no problem, because no function is implemented
>>in it.  But the StackFull is the one that I'm having problems with, here
>>is my code of the implementation of this two classes in same namespace.
>>
>># include "Stack.h"
>>
>>namespace StackExceptions : public Stack
>
>What that! Do not inherit your namespace from any thing.
>Simply write it as 
>
>namespace StackExceptions 
>
>>...deleted...
>>
>>This is the error that I get, What I want ot do is inherint fokrm Stack
>>then acces the method that that gives me the size of the Stack.
>>
>>
>>
>>ompiling...
>>main.cpp
>>c:\c++\stack\stack.h(1) : warning C4182: #include nesting level is 363
>>deep; possible infinite recursion
>>c:\c++\stack\stack.h(1) : fatal error C1076: compiler limit : internal
>>heap limit reached; use /Zm to specify a higher limit
>>Exceptions.cpp
>>c:\c++\stack\exceptions.h(1) : warning C4182: #include nesting level is
>>363 deep; possible infinite recursion
>>c:\c++\stack\exceptions.h(1) : fatal error C1076: compiler limit :
>>internal heap limit reached; use /Zm to specify a higher limit
>>Error executing cl.exe.
>>
>>main.exe - 2 error(s), 2 warning(s)
>>
>>Thank you Venkat for all the extra work that you do to assists us.
>
>You are most welcome.
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-625-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 21:34:30 2003
Return-Path: <uhcosc1320-return-625-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B2YU5Z1298030
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 21:34:30 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B2YTDI013971
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 21:34:29 -0500 (CDT)
Received: (qmail 12633 invoked by uid 108); 11 Aug 2003 02:40:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30057 invoked from network); 11 Aug 2003 02:15:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110209.h7B29f241303346@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 21:09:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: [uhcosc1320] size function for assignment4 (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 621
Content-Length: 2201
X-Keywords: $NotJunk                                                                                           

>I'm sorry to keep bothering you, but from what you just stated, is there no way to call the size function which is in my Stack class from the StackFull class?  Is this correct?  Thank you again.

Yes. More important, there should be no way. It is just an exception
that has some information about what happend or details about it.

Venkat

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/10/03 06:47 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: Re: [uhcosc1320] size function for assignment4 (fwd)
>
>> 
>> >Regarding the size function in StackFull, if I inherate it from the Stack
>class, can't it call the size function I have in my Stack function?  Can
>you explain.  Since StackFull won't call the size in Stack, do you see any
>point in having it inherate from Stack?   Thanks.
>
>Remember what inheritance means. It leads to substituitability.
>By inheriting you are saying an object of derived is also
>an object of base. By inheriting exception class StackFull from Stack,
>you are saying it is a Stack as well. Does it make sense to inherit 
>StackFull from Stack?
>
>Venkat
>
>>
>>-------Original Message-------
>>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>>Sent: 08/10/03 04:00 PM
>>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>>Subject: [uhcosc1320] size function for assignment4 (fwd)
>>
>>> 
>>> >For my catch in the main when it trys to read the maxsize of the
>array, I
>>get an error stating: error C2039: 'size' : is not a member of
>'StackFull'  
>>
>>>I don't understand why I'm gettting this error when I have the
>>excetptions classes part of the Stack class.  I know the following is not 
>complete,
>>but can you see why I am getting this error message.  THanks.
>>>
>>
>>>From the assign4.cpp you can see that 
>>
>>ex.size() is called from within the catch blow.
>>
>>This expect the StackFull class to have a method called size.
>>
>>Does your StackFull class have a method called size?
>>
>>Venkat
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-626-cosc155g=bayou.uh.edu@agiledeveloper.com Sun Aug 10 21:36:20 2003
Return-Path: <uhcosc1320-return-626-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B2aK5Z1301968
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 21:36:20 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B2aJDI014035
	for <cosc155g@bayou.uh.edu>; Sun, 10 Aug 2003 21:36:19 -0500 (CDT)
Received: (qmail 13868 invoked by uid 108); 11 Aug 2003 02:41:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12563 invoked from network); 11 Aug 2003 02:40:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110234.h7B2YGKs1280799@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Sun, 10 Aug 2003 21:34:16 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] namespace question (fwd)
X-Spam-Status: No, hits=0.4 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 622
Content-Length: 1576
X-Keywords: $NotJunk                                                                                           

>Sorry again, but when it tell me about the error and askes me to see the declaration, why does it go to 
>namespace StackExceptions{
>   	class StackEmpty{};
>   	class StackFull{};
>}
> instead of going to the Exception.h or .cpp file.  The method is also implemented there too, but why go to the above code.
>

The above code is where it is expecting to find the size method
and it could not find it. Put the method size in the
StackFull class and see what it does.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/10/03 07:10 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] namespace question (fwd)
>
>> 
>> >When I have the namespace code in my Stack.h file:
>>namespace StackExceptions{
>>   	class StackEmpty{};
>>   	class StackFull{};
>>}
>>
>>when I run the code, it says that method size is not a member of the
>StackEmpty class.  And then it says see declaration and it takes me directly to 
>the above code instead of the Exception.h or .cpp file.  And so, I have to 
>implement the size function here in the namespace.  Can you explain why
>this is so?  Thanks.
>
>The size function is a method of StackFull class!
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-627-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 04:13:49 2003
Return-Path: <uhcosc1320-return-627-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B9Dn5Z1315463
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:13:49 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B9DmDI025761
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:13:48 -0500 (CDT)
Received: (qmail 3090 invoked by uid 108); 11 Aug 2003 09:19:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30810 invoked from network); 11 Aug 2003 09:11:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110905.h7B95F9k1315813@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 04:05:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment 4 ? (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 623
Content-Length: 727
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>u' ve asked to include "Exceptions.h" in Exceptions.cpp but i only have 
>StackFull and StackEmpty in my namespace StackExceptions so can i include both 
>these classes in Exception.cpp?

Exceptions.h and Exceptions.cpp are files. The Exceptions.h file will
hold the classes StackEmpty and StackFull. The Exceptions.cpp will
hold the implementation of these classes. When writing Exceptions.cpp,
you will have to put a #inclue"Exceptions.h", isn't it?

>Also can i include stack.h in exceptions.h so i can access Stack::getSize 
>from StackFull::size ?
>thanks

Why should the StackFull exception class know and depend on the 
Stack class. The worst form of dependency between classes is
cyclic dependency.

Venkat

From uhcosc1320-return-628-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 04:21:46 2003
Return-Path: <uhcosc1320-return-628-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B9Lk5Z1321682
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:21:46 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B9LjDI026012
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:21:46 -0500 (CDT)
Received: (qmail 7596 invoked by uid 108); 11 Aug 2003 09:27:26 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32154 invoked from network); 11 Aug 2003 09:13:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110907.h7B97jt41284229@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 04:07:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] FIFO example (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 624
Content-Length: 637
X-Keywords: $NotJunk                                                                                           

>Venkat:
>
>Two questions:
>1. Why did you pass by value on the add function in FIFO? 

Good question. 

>2. What would happen if the copy constructor in FIFO was called and the
>elements(MEMBER's were objects) needed arguments for their
>constructor/copy constructor? 
>
>thanx,

If the FIFO is going to hold not copies of the object, but
reference or pointers to objects, then it should not depend on
the arguments to constructors or copy constructor.

Very good observations.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-@agiledeveloper.com Mon Aug 11 04:42:54 2003
Return-Path: <uhcosc1320-return-@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B9gs5Z1266350
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:42:54 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B9grDI026721
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:42:53 -0500 (CDT)
Received: (qmail 19230 invoked by uid 108); 11 Aug 2003 09:48:34 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Date: 11 Aug 2003 09:48:34 -0000
Message-ID: <1060595314.19229.ezmlm@agiledeveloper.com>
From: uhcosc1320-reject-1060595314.19229.lclelopjmedbpcbhihpm@agiledeveloper.com
Reply-To: uhcosc1320-accept-1060595314.19229.lclelopjmedbpcbhihpm@agiledeveloper.com
To: Recipient list not shown: ;
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary=gnmgpjofopimpjpaimlf
Subject: MODERATE for uhcosc1320@agiledeveloper.com
X-Spam-Status: No, hits=2.7 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 625
Content-Length: 3060
X-Keywords: $NotJunk                                                                                           

--gnmgpjofopimpjpaimlf
Content-Type: text/plain; charset=us-ascii

The enclosed message was submitted to the uhcosc1320@agiledeveloper.com
mailing list. If you'd like to approve it for distribution to all
the subscribers, please e-mail:

   uhcosc1320-accept-1060595314.19229.lclelopjmedbpcbhihpm@agiledeveloper.com

Usually, this happens when you just hit the "reply" button. You can
check the address to make sure that it starts with
"uhcosc1320-accept". If this does not work, simply copy the
address and paste it into the "To:" field of a new message.

To reject the post and cause it to be returned to the
sender, please send a message to:

   uhcosc1320-reject-1060595314.19229.lclelopjmedbpcbhihpm@agiledeveloper.com

Usually, it is easiest to hit the "reply-to-all" button, and then
remove all the addresses except the one starting with
"uhcosc1320-reject".

You do not need to copy the post in your response to accept or 
reject it. If you wish to send a comment to the sender of a rejected
post, please include it between two marker lines starting with three
percent signs ('%'):

%%% Start comment
%%% End comment

Thank you for your help!

--- Enclosed, please find the posted message.


--gnmgpjofopimpjpaimlf
Content-Type: message/rfc822

Return-Path: <cosc155g@Bayou.UH.EDU>
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19039 invoked from network); 11 Aug 2003 09:48:10 -0000
Received: from bay.uh.edu (HELO Bayou.UH.EDU) (129.7.235.4)
  by mx251.mysite4now.com with SMTP; 11 Aug 2003 09:48:34 -0000
Received: from bay.uh.edu (localhost [127.0.0.1])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B9gN5Z1309649
	for <uhcosc1320@agiledeveloper.com>; Mon, 11 Aug 2003 04:42:23 -0500 (CDT)
Received: (from cosc155g@localhost)
	by bay.uh.edu (8.12.9/8.12.9/Submit) id h7B9gNLW1315865
	for uhcosc1320@agiledeveloper.com; Mon, 11 Aug 2003 04:42:23 -0500 (CDT)
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110942.h7B9gNLW1315865@bay.uh.edu>
Subject: Could you please check my assign4 (fwd)
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 04:42:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

>Dear Venkat,
>
>I was wondering if you could take a look at my code and see if it might fail 
>any tests you might run on it. In other words, please give me some hints if 
>you think I haven't implemented something that should have been taken care 
>of.
>
>I am yet to add comments.
>
>Thanks,

Yesterday I sent a code review for the code from one of the students.
Please refer to it. The test case will be posted on Wednesday for you
to try. I do not want to give you the idea that I will review each
ones code (and I will end up reviewing more than a 100 of those then). 
I generally review one code per assignement submission, selected in random.

If you want me to look at some thing specific with your code, let me know
and I will.

Venkat

--gnmgpjofopimpjpaimlf--

From uhcosc1320-return-@agiledeveloper.com Mon Aug 11 04:45:42 2003
Return-Path: <uhcosc1320-return-@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B9jg5Z1316946
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:45:42 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B9jfld004336
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:45:41 -0500 (CDT)
Received: (qmail 20629 invoked by uid 108); 11 Aug 2003 09:51:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Date: 11 Aug 2003 09:51:23 -0000
Message-ID: <1060595483.20627.ezmlm@agiledeveloper.com>
From: uhcosc1320-reject-1060595483.20627.kfjpkclgbpbghambjfgb@agiledeveloper.com
Reply-To: uhcosc1320-accept-1060595483.20627.kfjpkclgbpbghambjfgb@agiledeveloper.com
To: Recipient list not shown: ;
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary=anldfaojdlgaepbpbaef
Subject: MODERATE for uhcosc1320@agiledeveloper.com
X-Spam-Status: No, hits=2.7 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 626
Content-Length: 3291
X-Keywords: $NotJunk                                                                                           

--anldfaojdlgaepbpbaef
Content-Type: text/plain; charset=us-ascii

The enclosed message was submitted to the uhcosc1320@agiledeveloper.com
mailing list. If you'd like to approve it for distribution to all
the subscribers, please e-mail:

   uhcosc1320-accept-1060595483.20627.kfjpkclgbpbghambjfgb@agiledeveloper.com

Usually, this happens when you just hit the "reply" button. You can
check the address to make sure that it starts with
"uhcosc1320-accept". If this does not work, simply copy the
address and paste it into the "To:" field of a new message.

To reject the post and cause it to be returned to the
sender, please send a message to:

   uhcosc1320-reject-1060595483.20627.kfjpkclgbpbghambjfgb@agiledeveloper.com

Usually, it is easiest to hit the "reply-to-all" button, and then
remove all the addresses except the one starting with
"uhcosc1320-reject".

You do not need to copy the post in your response to accept or 
reject it. If you wish to send a comment to the sender of a rejected
post, please include it between two marker lines starting with three
percent signs ('%'):

%%% Start comment
%%% End comment

Thank you for your help!

--- Enclosed, please find the posted message.


--anldfaojdlgaepbpbaef
Content-Type: message/rfc822

Return-Path: <cosc155g@Bayou.UH.EDU>
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20540 invoked from network); 11 Aug 2003 09:51:15 -0000
Received: from bay.uh.edu (HELO Bayou.UH.EDU) (129.7.235.4)
  by mx251.mysite4now.com with SMTP; 11 Aug 2003 09:51:22 -0000
Received: from bay.uh.edu (localhost [127.0.0.1])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B9jT5Z1316242
	for <uhcosc1320@agiledeveloper.com>; Mon, 11 Aug 2003 04:45:29 -0500 (CDT)
Received: (from cosc155g@localhost)
	by bay.uh.edu (8.12.9/8.12.9/Submit) id h7B9jT4f1322036
	for uhcosc1320@agiledeveloper.com; Mon, 11 Aug 2003 04:45:29 -0500 (CDT)
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110945.h7B9jT4f1322036@bay.uh.edu>
Subject: Question about pop (fwd)
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 04:45:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

>Hi Venkat.
>I was wondering when we have the pop fuction as
>template<class MEMBER> const MEMBER& Stack<MEMBER>::pop()
>		{
>			MEMBER val;

Wait. How can you return a reference to some thing created on the
stack like this?

> ...deleted...

>I return the object as a const MEMBER& but what if some one who uses my 
>class wants to pop the object and use it. then can he/she use and make 
>changes to the object if I send it as const MEMBER&
>as const says that you can't change the object returned. So do we have to 
>overload pop.

You do not have to overload pop. You simply return to them a reference
instead of const reference. That way a caller can use the returned
element for what ever they choose.

>I am thinking right, or am I thinking to much into it.
>
>Thanks
>Best Regards

You are in the right direction of thinking.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

--anldfaojdlgaepbpbaef--

From uhcosc1320-return-629-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 04:48:57 2003
Return-Path: <uhcosc1320-return-629-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7B9mv5Z1321257
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:48:57 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7B9muDI026955
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 04:48:56 -0500 (CDT)
Received: (qmail 22441 invoked by uid 108); 11 Aug 2003 09:54:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17478 invoked from network); 11 Aug 2003 09:45:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110939.h7B9dQYf1321887@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 04:39:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assign4 - templates (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 627
Content-Length: 2883
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>Whenever I compile my code, it gives me the following
>errors. Is it because of my implementation in Stack.h
>is done incorrectly? I've looked at other emails and I
>changed my program to that format, but it still gives
>me these errors. Can you please take a look at my
>attached files?? Thanks so much for your time. =)
>
>Compiling...
>assign4.cpp
>d:\cosc1320\assign4\assign4\stack.h(105) : error
>C2955: 'Stack' : use of class template requires
>template argument list
>        d:\cosc1320\assign4\assign4\stack.h(31)
>: see declaration of 'Stack'
>d:\cosc1320\assign4\assign4\stack.h(118) : error
>C2244: 'Stack<MEMBER>::=' : unable to resolve function
>overload
>D:\cosc1320\Assign4\assign4\assign4.cpp(31) :
>error C2514: 'Stack<int>' : class has no constructors
>D:\cosc1320\Assign4\assign4\assign4.cpp(31) :
>error C2262: 'stk' : cannot be destroyed
>D:\cosc1320\Assign4\assign4\assign4.cpp(33) :
>error C2027: use of undefined type 'Stack<int>'
>D:\cosc1320\Assign4\assign4\assign4.cpp(33) :
>error C2228: left of '.push' must have
>class/struct/union type
>D:\cosc1320\Assign4\assign4\assign4.cpp(34) :
>error C2027: use of undefined type 'Stack<int>'
>D:\cosc1320\Assign4\assign4\assign4.cpp(34) :
>error C2228: left of '.push' must have
>class/struct/union type
>D:\cosc1320\Assign4\assign4\assign4.cpp(36) :
>error C2027: use of undefined type 'Stack<int>'
>D:\cosc1320\Assign4\assign4\assign4.cpp(36) :
>error C2228: left of '.pop' must have
>class/struct/union type
>D:\cosc1320\Assign4\assign4\assign4.cpp(37) :
>error C2027: use of undefined type 'Stack<int>'
>D:\cosc1320\Assign4\assign4\assign4.cpp(37) :
>error C2228: left of '.count' must have
>class/struct/union type
>D:\cosc1320\Assign4\assign4\assign4.cpp(39) :
>error C2027: use of undefined type 'Stack<int>'
>D:\cosc1320\Assign4\assign4\assign4.cpp(39) :
>error C2228: left of '.pop' must have
>class/struct/union type
>D:\cosc1320\Assign4\assign4\assign4.cpp(40) :
>error C2027: use of undefined type 'Stack<int>'
>D:\cosc1320\Assign4\assign4\assign4.cpp(40) :
>error C2228: left of '.count' must have
>class/struct/union type
>D:\cosc1320\Assign4\assign4\assign4.cpp(42) :
>error C2027: use of undefined type 'Stack<int>'
>D:\cosc1320\Assign4\assign4\assign4.cpp(42) :
>error C2228: left of '.pop' must have
>class/struct/union type
>D:\cosc1320\Assign4\assign4\assign4.cpp(46) :
>fatal error C1903: unable to recover from previous
>error(s); stopping compilation
>Error executing cl.exe.

1. You have written

template <class MEMBER>
const Stack& Stack<MEMBER>::operator=(const Stack& other)

Replace this with
template <class MEMBER>
const Stack<MEMBER>& Stack<MEMBER>::operator=(const Stack<MEMBER>& other)

2. You have used StackFull or StackEmpty in the Stack class implementation.
	You may want to use StackExceptions::StackFull and 
	StackExceptoins::StackEmpty instead.

Venkat

From uhcosc1320-return-630-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 05:00:24 2003
Return-Path: <uhcosc1320-return-630-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BA0O5Z1564470
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:00:24 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BA0NDI027382
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:00:23 -0500 (CDT)
Received: (qmail 28980 invoked by uid 108); 11 Aug 2003 10:06:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 12688 invoked from network); 11 Aug 2003 09:36:45 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110930.h7B9UwS01316902@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 04:30:58 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Subject: [uhcosc1320] Debug error messages (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 628
Content-Length: 2053
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>I have submitted my program.  But I was wondering if you can take a look at 
>it.  It seems to be doing what it's suppose to so far.  I have not tested it 
>extensively yet or cleaned it up, but it seems to work for the most part.

Yesterday I sent a code review for some one who had sent it for review.
I had mentioned a few things to look out for. I suggest that you 
take a look at it.

>But...I keep getting these "Debug Errors".  I have no idea where to begin to 
>fix these errors.  I was wondering if you could shine some light about these 
>errors.
>
>Here are the error messages:  (there's 4 of them)
>
>1)	Debug Error!
>
>Program:  …\MVS\My Projects\Assign4\Debug\Assign4.exe
>
>Damage: after Normal block (#63) at 0x00811DC0.
>
>
>
>2)	Debug Assertion Failed!
>
>Program: …\MVS\My Projects\Assign4\Debug\Assign4.exe
>File: dbgheap.c
>Line: 1017
>
>Expression: BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
>
>3)	Debug Error!
>
>Program: …\MVS\My Projects\Assign4\Debug\Assign4.exe
>
>Damage: before (null) block (#-572662307) at 0x00810030.
>
>4)	Assign4.exe – Application Error
>
>The instruction at “0x00425933” referenced memory at “0xde5ede0d”. The 
>memory could not be “read”.
>
>
>Thank you so much for your help,

These are generally indicative of problems with trying to 
delete memory that your program (process) may not own.
You may want to take a close look at how you are allocating
memory on the heap and how you are cleaning it up.

One easy way to find if this is the problem is to comment out
the delete(s) from your code and run the program. If it
does not give you these errors, it is indicative that the error
is caused when you are tyring to delete the heap memory. Then
you can take a close look at how you are allocating and deallocating.
Try this and if you still can't figure it out, email me your entire
project and I will take a look at it for you.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-631-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 05:04:55 2003
Return-Path: <uhcosc1320-return-631-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BA4t5Z1296106
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:04:55 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BA4sDI027526
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:04:54 -0500 (CDT)
Received: (qmail 31697 invoked by uid 108); 11 Aug 2003 10:10:35 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23689 invoked from network); 11 Aug 2003 09:56:39 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110950.h7B9oq7B1320421@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 04:50:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] What happened to the Bonus point for FIFO? (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 629
Content-Length: 882
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>Did anyone get the bonus point for Fifo after all? You said that you were
>waiting on another one with a better solution than 'donut'... Or did I miss
>another email? 

I got a better answer though not code (from the same person who grabed most of 
the other bonus points, of course). However, if some one can send me the 
correct code, the bonus point is for them. P.S. you can solve the problem
actually by eliminating some code and variables instead of adding donuts
or another array like some have suggested. Some one said (s)he wrote a 
readable code by loosing performance. You can actually make the code
readable and yet provide better performance. Think about it.

So, any one to claim the bonus still? 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-632-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 05:07:05 2003
Return-Path: <uhcosc1320-return-632-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BA745Z1322349
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:07:05 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BA74ld005412
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:07:04 -0500 (CDT)
Received: (qmail 559 invoked by uid 108); 11 Aug 2003 10:12:45 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28539 invoked from network); 11 Aug 2003 10:05:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110959.h7B9xN0P1307982@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 04:59:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] big 3 in assign 4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 630
Content-Length: 701
X-Keywords: $NotJunk                                                                                           

>hello venkat,
>
>do we need to include a copy constructor, assignment
>operator and destructor for assignment three?  

Discussed already in previous emails.

>also,
>can we include a linked list class to use with our
>stack class?  in data structures, we incorporated our
>stack into our list link structure which made it a
>little easier instead of having to write the entire
>structure functions again.
>
>thanks

What ever you want to include is fine as long as the my main (assign4.cpp) 
does not have to change to accomodate your code.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-633-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 05:07:08 2003
Return-Path: <uhcosc1320-return-633-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BA785Z1318625
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:07:08 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BA77ld005416
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:07:07 -0500 (CDT)
Received: (qmail 730 invoked by uid 108); 11 Aug 2003 10:12:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27495 invoked from network); 11 Aug 2003 10:03:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308110957.h7B9vcd71317791@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 04:57:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Default Constructors for a Stack of Objects (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 631
Content-Length: 1722
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I am testing my Stack class, and I wrote a very simple TestClass to use =
>as a parameter for a Stack object.  TestClass has a few member =
>variables, and the constructor for TestClass takes arguments to assign =
>to the member variables. =20

Good idea for a test case.

>My Stack class creates an array of objects on the heap.  When I try to =
>declare an instance of the Stack class using TestClass as the parameter, =
>it attempts to allocate space on the heap for an array of TestClass =
>objects.  

May be that is not such a good idea. 

>However, if I don't either overload the TestClass constructor =
>with a default constructor (one that takes no arguments), or provide =
>default arguments in the existing constructor, then the program won't =
>compile - it says that there is no appropriate default constructor for =
>TestClass when it tries to allocate space for an array of TestClass =
>objects.

Good, that is what I would expect it to do.

>Is there a way around this?  

Yes. You may consider not allocating an array of objects. After all,
when you want to put people in the queue, you do not want copy of the
people in the queue, but the people themselves, isn't it.

>And if not, when you run your test code =
>against our code, if you create a Stack of objects, will those objects =
>have a default constructor?
>
>Thank you for your time,

Oh, I am sure you know the answer to this one. Will I test your code with
some thing like what you are trying to test with? You bet. :)

There were at least two emails today (including this one) which have
hit the problem right on the head. So, those who think they are done
with their assignment can now start thinking. 

Good questions. 

Venkat

From uhcosc1320-return-634-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 05:11:44 2003
Return-Path: <uhcosc1320-return-634-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BABi5Z1324294
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:11:44 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BABhDI027779
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 05:11:43 -0500 (CDT)
Received: (qmail 3403 invoked by uid 108); 11 Aug 2003 10:17:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31660 invoked from network); 11 Aug 2003 10:10:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308111004.h7BA4iNn1313063@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 05:04:44 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] COSC1320 assignment#4 problem (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 632
Content-Length: 2090
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>    I have a problem that I have been trying to solve for the past few 
>hours, please help.
>
>I have been trying out test runs of the stack object of type int, double, 
>char, objects of a class, char *
>
>The problem comes with char * .
>
>//////////////////////////////
>Example)
>
>Stack< char * > stack01(5);
>
>char tempString[15] = {0};
>strcpy(tempString, "hello there");
>
>stack01.push(tempString); // the string "hello there" is on the stack at 
>index 0
>
>strcpy(tempString, "changed");   //this changes the string to "changed" on 
>the stack at index 0
>
>strcpy(tempString, "");     //now string is "" blank on the stack at index 0
>///////////////////////////
>
>Basically it comes to can we assume you won't change/delete the data pushed 
>on the stack until it is popped off the stack?

No, but think about it. If a person gets on to a queue or a stack 
and decides to change name that is fine. For example, there are times
some one asks you how old you are before you enter a queue say at
the post office. By the time you get out of the queue, you are much
older (at least it feels that way at my post office). Objects are
in the stack. They can change while they are in the stack. That is
perfectly ok. Just don't delete them while they are in the stack.

>
>This problem comes with pushing pointers/references.
>

Good for you. (and it is not a problem after all if you are inline with
what I am saying above). 

>///////////////////////////
>Now if we change the above code to below, there is no problem:
>
>Stack < char * > stack01(5);
>
>stack01.push("hello there");
>
>cout << stack01.pop() << endl;  //outputs "hello there"
>
>///////////////////////////
>
>Thank you 8o)

Well, the reason is you are not changing the content after you put it
in. That is why you are not seeing the problem (if that is a problem at all).

You have answers to questions raised in previous emails. Good job.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-635-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 09:09:55 2003
Return-Path: <uhcosc1320-return-635-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BE9t5Z1334627
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 09:09:55 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BE9sld017417
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 09:09:55 -0500 (CDT)
Received: (qmail 27913 invoked by uid 108); 11 Aug 2003 14:15:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26804 invoked from network); 11 Aug 2003 14:14:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308111408.h7BE8KAd1321824@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 09:08:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] char vs char* (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 633
Content-Length: 750
X-Keywords: $NotJunk                                                                                           

>Hello Venkat,
>
>In a previous email someone had an object declared like this 
>
>Stack< char * > stack01(5);
>
>Now i tried that in my code and got the follow error:-
>error C2664: 'push' : cannot convert parameter 1 from 'const char' to 'char *const & '
>Reason: cannot convert from 'const char' to 'char *const '
>
>but declaring it like this 
>Stack< char> stack01(5); , it compiled fine and ran well.
>
>Any reason why it isnt working like that?

You may want to check your push method in main to make sure
you are sending some string like "somestring" rather than one 
char like 'c'. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-636-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 10:16:25 2003
Return-Path: <uhcosc1320-return-636-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BFGP5Z1338790
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 10:16:25 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BFGOld019942
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 10:16:25 -0500 (CDT)
Received: (qmail 23891 invoked by uid 108); 11 Aug 2003 15:22:06 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20311 invoked from network); 11 Aug 2003 15:18:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308111512.h7BFCmua1330678@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 10:12:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] problem with private copy constructor in template (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 634
Content-Length: 1438
X-Keywords: $NotJunk                                                                                           

>Venkat,
>          Everything seemed to be going great with my assignment 4 until I
>restored your original test harness.  Now, the simplest case breaks, but
>others still work.  The compilation error is on this line:
> 
>Stack<int> stk(5);
> 
>The error is:
> 
>c:\Projects\Net\School\COSC1320\assign4\assign4\assign4.cpp(31) : error
>C2668: 'Stack<ITEM>::__ctor' : ambiguous call to overloaded function
>        with
>        [
>            ITEM=int
>        ]
>        and
>        [
>            ITEM=int
>        ]
>        c:\Projects\Net\School\COSC1320\assign4\assign4\Stack.h(44): could
>be 'Stack<ITEM>::Stack(const ITEM &)'
>        with
>        [
>            ITEM=int
>        ]
>        c:\Projects\Net\School\COSC1320\assign4\assign4\Stack.h(18): or
>'Stack<ITEM>::Stack(int)'
>        with
>        [
>            ITEM=int
>        ]
>        while trying to match the argument list '(int)'
> 
> 
>This error doesn't happen if I remove my private copy constructor:
> 
>private:
>      Stack(const ITEM&);
> 
>How in the world could there be an ambiguity between public constructor and
>a private copy constructor from outside the class?  The private copy
>constructor should be completely unknown in the context where the error is
>happening.
> 

Some times templates confuse the best of us!

The signature of a copy constructor for Stack would take const Stack<ITEM>&
as argument and not const ITEM&, isn't it.

Venkat

From uhcosc1320-return-637-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 10:16:56 2003
Return-Path: <uhcosc1320-return-637-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BFGu5Z1329178
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 10:16:56 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BFGtDI007418
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 10:16:56 -0500 (CDT)
Received: (qmail 24621 invoked by uid 108); 11 Aug 2003 15:22:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22169 invoked from network); 11 Aug 2003 15:20:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308111514.h7BFEj1j1301078@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 10:14:45 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Default Constructors for a Stack of Objects (fwd)
X-Spam-Status: No, hits=0.4 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 635
Content-Length: 2574
X-Keywords: $NotJunk                                                                                           

>So you said that our class Stack should be able to handle creating an array of 
>objects.  But if you tell us not to allocate an array of objects, how else can 
>we create this array?  Thanks.

Think my friend. Some one said "Give some one a fish you have fed them a meal, 
teach them fishing, you have fed them for life." I am trying to teach you
fishing, so work with me.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/11/03 02:57 AM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] Default Constructors for a Stack of Objects (fwd)
>
>> 
>> >Venkat,
>>
>>I am testing my Stack class, and I wrote a very simple TestClass to use =
>>as a parameter for a Stack object.  TestClass has a few member =
>>variables, and the constructor for TestClass takes arguments to assign =
>>to the member variables. =20
>
>Good idea for a test case.
>
>>My Stack class creates an array of objects on the heap.  When I try to =
>>declare an instance of the Stack class using TestClass as the parameter,
>=
>>it attempts to allocate space on the heap for an array of TestClass =
>>objects.  
>
>May be that is not such a good idea. 
>
>>However, if I don't either overload the TestClass constructor =
>>with a default constructor (one that takes no arguments), or provide =
>>default arguments in the existing constructor, then the program won't =
>>compile - it says that there is no appropriate default constructor for =
>>TestClass when it tries to allocate space for an array of TestClass =
>>objects.
>
>Good, that is what I would expect it to do.
>
>>Is there a way around this?  
>
>Yes. You may consider not allocating an array of objects. After all,
>when you want to put people in the queue, you do not want copy of the
>people in the queue, but the people themselves, isn't it.
>
>>And if not, when you run your test code =
>>against our code, if you create a Stack of objects, will those objects =
>>have a default constructor?
>>
>>Thank you for your time,
>
>Oh, I am sure you know the answer to this one. Will I test your code with
>some thing like what you are trying to test with? You bet. :)
>
>There were at least two emails today (including this one) which have
>hit the problem right on the head. So, those who think they are done
>with their assignment can now start thinking. 
>
>Good questions. 
>
>Venkat
>> 
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-638-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 13:24:51 2003
Return-Path: <uhcosc1320-return-638-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BIOp5Z1337875
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 13:24:51 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BIOold027248
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 13:24:50 -0500 (CDT)
Received: (qmail 11179 invoked by uid 108); 11 Aug 2003 18:30:32 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32076 invoked from network); 11 Aug 2003 18:18:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308111812.h7BICQgI1347262@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 13:12:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Stack destructor (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 636
Content-Length: 725
X-Keywords: $NotJunk                                                                                           

>I read from the previous email about an error regarding an _dtor.  I am getting the same error but on my Stack destructor.  THe following is what I have:
>
>...deleted...
>I get the following two errors, but when I try to debug it, I can't figure out whats wrong.  Can you please help.  THanks.
>
>error C2244: 'Stack<TYPE>::__dtor' : unable to resolve function overload
>error C2954: template definitions cannot nest

>From the code segment you have sent, I can not figure out what the
problem is. I will have to take a look at the entire code to see
what's wrong.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-639-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 13:27:27 2003
Return-Path: <uhcosc1320-return-639-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BIRR5Z1347087
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 13:27:27 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BIRQDI013623
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 13:27:26 -0500 (CDT)
Received: (qmail 13924 invoked by uid 108); 11 Aug 2003 18:33:09 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1241 invoked from network); 11 Aug 2003 18:19:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308111814.h7BIE8eK1295051@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 13:14:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] question on assignment4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 637
Content-Length: 563
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>         I have read all the other e-mails and I am still having trouble as to how to test my code using a class. Do I write a class in another header file and include it  into the project? If so, how would I call on it so that it uses my Stack? 
>Thanks.

You will have to create a new class. You can put that in either 
separate file(s)  or you can put that as part of the file that
contains your test code that uses the test class. If you write it
in a separate file, you need to include it in the file that
contains the test code (main).

Venkat

From uhcosc1320-return-641-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:41:01 2003
Return-Path: <uhcosc1320-return-641-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5f15Z1384676
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:41:01 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5f1DI006625
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:41:01 -0500 (CDT)
Received: (qmail 4506 invoked by uid 108); 12 Aug 2003 05:46:46 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3410 invoked from network); 12 Aug 2003 04:54:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120449.h7C4n6W11377440@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 23:49:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] problem with private copy constructor in template (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 638
Content-Length: 755
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>I have a couple of questions,
>
>how come you didn't write the copy constructor in FiFo as
>FiFo(const FiFo<MEMBER>& other)

It is of that form. Since I wrote it within the class, 
I ignore the <MEMBER>. If you implement it outside the class, 
you need to put the <MEMBER>.

>And can you please verify the operator= signature also is this correct.
>
>...deleted...
>
>And is it okay to assume that when you test our assignment your class will 
>have a constructor with either no arguments or the one with default 
>arguments, and that you will have a working operator= as you need that in 
>push. And a copy constructor because I am returning a copy in pop.
>
>Thanks
>Best Regards

I would not assume any of those you have stated :)

Venkat

From uhcosc1320-return-642-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:41:03 2003
Return-Path: <uhcosc1320-return-642-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5f35Z1386754
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:41:03 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5f2DI006630
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:41:03 -0500 (CDT)
Received: (qmail 4664 invoked by uid 108); 12 Aug 2003 05:46:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3405 invoked from network); 12 Aug 2003 05:45:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120539.h7C5dJT31377326@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:39:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] copy constructor (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 639
Content-Length: 971
X-Keywords: $NotJunk                                                                                           

>I had sent you an email previously.  I was told by others to place the copy constructor protected, like in the FIFO example.  My copy constructor which is protected is as follows:
>...deleted...
>
>I have been playing with this for a while now, and I cannot figure out why I am getting a syntax error when I have the following code:
>
>...deleted...
In main you have
>		Stack<int> stk2(3)=stk;  //syntax error here;something about missing a ';' before the '='.

You said you made the copy constructor protected. If it is protected,
will you be able to access it from main? 

Secondly, the syntax

Stack<int> stk2(3)=stk;  

is invalid. You are probably trying

Stack<int> stk2=stk;  

Again, if your copy constructor is protected, should the above line
compile? You may want to think about what protected means.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-643-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:41:38 2003
Return-Path: <uhcosc1320-return-643-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5fb5Z1385907
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:41:37 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5fbDI006670
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:41:37 -0500 (CDT)
Received: (qmail 5130 invoked by uid 108); 12 Aug 2003 05:47:17 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1602 invoked from network); 12 Aug 2003 05:41:57 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120536.h7C5a6s41384162@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:36:06 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] a4: Putting objects in the stack (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 640
Content-Length: 1926
X-Keywords: $NotJunk                                                                                           

>To Venkat,
>I haven't emailed you this semester since I always got the answer from the 
>emails, but I am utterly stuck at this point.  

Alright, finally we got to hear from you. Better late than never.

>My question is about putting 
>objects of some class inside the stack.  I know you have already answered 
>others on this same issue, but question is slighty differnt.  I was trying 
>to do this:
>
>// aClass is previously defined, takes two arguments
>
>Stack<aClass> s1(3);
>aClass c1(1,4);
>s1.push(c1);
>
>// end
>this gives me:
>error C2512: 'aClass' : no appropriate default constructor available
>
>You said in the previous email that this might be due to the fact that we're 
>allocating an array of objects on the heap and that this is not a good idea.
>  >My Stack class creates an array of objects on the heap.  When I try   to 
>=
>  >declare an instance of the Stack class using TestClass as the   
>parameter, =
>  >it attempts to allocate space on the heap for an array of TestClass   =
>  >objects.
>
>  May be that is not such a good idea.
>
>I have thought a lot about it and I was thinking of maybe doing a linklist, 
>but I gave up on this idea.  The last thing I thought of was to make an 
>array of pointers and these pointers would point at the type for the 
>template (i.e. <MEMBER>).  So we could push and pop objects, not on the 
>heap, but simply accessing them from the pointers.....

Sounds like a plan to me.

>Am I going in the right direction, or am I totally lost?  

I think you are doing good.

>I think I'm lost 
>because I couldn't understand how to make an array of pointers and then 
>assign elements to those pointers.  Any suggestions for someone in trouble?
>p.s. I am also sending you my Stack.h in case you see something totally 
>wrong...
>
>Thank You

I have not looked at your Stack.h. Your description above tell me you
are pretty close to the problem. Good job.

Venkat

From uhcosc1320-return-644-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:43:43 2003
Return-Path: <uhcosc1320-return-644-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5hh5Z1385349
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:43:43 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5hgDI006747
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:43:43 -0500 (CDT)
Received: (qmail 6562 invoked by uid 108); 12 Aug 2003 05:49:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31387 invoked from network); 12 Aug 2003 05:37:19 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120531.h7C5VSOM1372834@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:31:28 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Help on error messages (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 641
Content-Length: 340
X-Keywords: $NotJunk                                                                                           

>I am getting the following errors could you please help me:
>
>error C2011: 'StackExceptions::StackFull' : 'class' type redefinition
>...deleted...

There is no reason to include Stack.h in any file other than 
the assign4.cpp. So remove Stack.h from Exceptions.cpp.
Stack depends on exceptions. Exceptions do not depend on Stack.

Venkat

From uhcosc1320-return-645-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:43:58 2003
Return-Path: <uhcosc1320-return-645-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5hw5Z1387042
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:43:58 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5hwDI006762
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:43:58 -0500 (CDT)
Received: (qmail 6883 invoked by uid 108); 12 Aug 2003 05:49:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29038 invoked from network); 12 Aug 2003 05:33:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120527.h7C5RfNQ1386811@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:27:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Help on size() (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 642
Content-Length: 1404
X-Keywords: $NotJunk                                                                                           

>hello Venkat,
>
>I still don't understand how the size fuction in the
>StackExceptions::StackFull::size() is going to return an int that is the
>maxSize of the Stack object when exception is thrown.

Well, is it possible that when the exception is thrown the StackFull
exception object's constructor could take the stack's max size and the 
StackFull object can then give that information through the size method?
We have done similar things before in other assignments, havn't we?

>I concluded that StackFull class is not going to inherit from Stack, 

I commend you for that.

>I don't want a class that only provides information about something that
>went wrong in the program to be of type base class.  

I agree. Inheriting StackFull from Stack is a terrible thing to do.
Do not let your mind wander around such bad thoughts.

>But, I don't have
>access to the maxSize() on my Stack class.  I can't think of anything else
>to provide the max number of elements from
>StackExceptions::StackFull::size().
>
>Could you please give a little hint?

I have given you more than a hint above. Simply pass the information
in the constructor of StackFull.

>Thank you Venkat for all the patience throughout these five weeks.

You are most welcome. 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-646-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:44:05 2003
Return-Path: <uhcosc1320-return-646-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5i55Z1385426
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:44:05 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5i4DI006775
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:44:04 -0500 (CDT)
Received: (qmail 7095 invoked by uid 108); 12 Aug 2003 05:49:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13368 invoked from network); 12 Aug 2003 05:10:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120504.h7C54oFk1383458@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:04:50 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Exceptions in Assignment #4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 643
Content-Length: 1068
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>I am having a lot of trouble understanding the use of StackFull and
>StackEmpty in this assignment.
> 
>As you have already done for us, Exceptions.h is included in Stack.h.
>Therefore we will be using it for our pop and push methods, basically
>instead of checking in the Stack methods, like we did in FIFO, we will
>use the Exceptions class to do that for us.correct?

I am not sure if I understand what you mean by using it for our pop and
push methods. Within the pop and push, you would throw the StackEmpty
or StackFull exception as the case may be. If that is what you mean,
yep, you are correct.

> 
>In the StackFull class we will have a method called 'Size', which will
>really contain the MAXSIZE of the Stack.based on the output, that was my
>understanding. Instead of the "current size" of the Stack. Is my
>assumption correct?

This part looks reasonable.

> 
>Thanks for your time!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-647-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:44:46 2003
Return-Path: <uhcosc1320-return-647-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5ik5Z1377909
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:44:46 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5ijld028747
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:44:45 -0500 (CDT)
Received: (qmail 7624 invoked by uid 108); 12 Aug 2003 05:50:31 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14518 invoked from network); 12 Aug 2003 05:12:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120506.h7C56ODV1374459@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:06:24 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] stk redefinition error (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 644
Content-Length: 557
X-Keywords: $NotJunk                                                                                           

>hello Venkat,
>        I got an error when I build my project, it is stk redefinition on the Stack<double> stk(10). Could you tell me how to solve that? Thanks!
 
I am guessing without looking at your code. Make sure you do not 
have a variable defined in Stack.h by the name stk. You may also 
want to make sure a two or more variables with the same name  
stk do not exist within the same scope.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-648-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:46:08 2003
Return-Path: <uhcosc1320-return-648-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5k85Z1388658
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:46:08 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5k7ld028876
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:46:08 -0500 (CDT)
Received: (qmail 8647 invoked by uid 108); 12 Aug 2003 05:51:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6517 invoked from network); 12 Aug 2003 04:59:47 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120453.h7C4rubK1381467@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 23:53:56 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Confusion on template format (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 645
Content-Length: 580
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I am having trouble converting my code into a template.  I have read the emails and I have done what I think is correct.  However, I am getting a Debug Error as I exit the first try block of the main.  Here is my Stack.h file.  Please let me know if I am understanding this properly. 
>
>	pElements = new MEMBER(maxSize);

Should this be 

	pElements = new MEMBER[maxSize];

[ instead of ( and ] instead of ).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-649-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:47:04 2003
Return-Path: <uhcosc1320-return-649-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5l45Z1307964
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:47:04 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5l3ld028927
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:47:03 -0500 (CDT)
Received: (qmail 9336 invoked by uid 108); 12 Aug 2003 05:52:39 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 11783 invoked from network); 12 Aug 2003 05:08:14 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120502.h7C52Nb51382778@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:02:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] copy constructor / assignment operator (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 646
Content-Length: 1545
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I know that you've stated that you should make your copy constructors 
>protected but upon doing so and testing it out with my own code, I got a compile 
>error stating that :  cannot access protected member declared in Stack<double>  
>
>This is my test code:
>
>    Stack<double> stk1(10);
>    
>    stk1.push(1.2);
>    stk1.push(3.4);
>    stk1.push(5.6);
>
>    Stack<double> stk2 = stk1;
>
>
>If I make my copy constructor public, it works just fine.  Trying to fix it, 
>I changed my test code to:
>
>    Stack<double> stk1(10);
>    
>    stk1.push(1.2);
>    stk1.push(3.4);
>    stk1.push(5.6);     
>
>     Stack<double> stk2(10);
>     stk2 = stk1;
>
>This resulted in a compile error:  "=", cannot access private member declared 
>in Stack.  This again violates what you said about making your assignment 
>operator private.  Should I make the assignment operator public and implement it 
>accordingly?  Or am I going about this the wrong way?  Thanks in advance.

I think you are on the right track. Just get that confidence you need to
know that you are doing the correct thing.

Do you understand why the copy constructor is protected and the 
operator= is private? Any one who wants to answer this question.
Why should the copy constructor be protected and the operator= 
be private? The first correct answer gets a bonus point (and 
it will not be awarded to the person who has grabed most of the
bonus points so far! unless of course no one grabs it and he is
still the only one with the correct answer).

Venkat

From uhcosc1320-return-650-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:48:30 2003
Return-Path: <uhcosc1320-return-650-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5mU5Z1382835
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:48:30 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5mTld028990
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:48:30 -0500 (CDT)
Received: (qmail 10409 invoked by uid 108); 12 Aug 2003 05:54:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5185 invoked from network); 12 Aug 2003 04:57:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120451.h7C4pkjU1349380@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 23:51:46 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] do we need a mild pop function (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 647
Content-Length: 375
X-Keywords: $NotJunk                                                                                           

>Hi do we need a mild pop function by that I mean that a function that would 
>return what is at the top of the stack but not pop it.
>
>Thanks

You may write those additional, not required methods, at your own risk.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-651-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:49:11 2003
Return-Path: <uhcosc1320-return-651-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5nB5Z1390326
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:49:11 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5nAld029025
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:49:10 -0500 (CDT)
Received: (qmail 10981 invoked by uid 108); 12 Aug 2003 05:54:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15116 invoked from network); 12 Aug 2003 05:13:20 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120507.h7C57TVk1382152@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:07:29 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] operator= (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 648
Content-Length: 787
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>It seems like since we don't need to worry about mixing types with the
>assignment operator (b/c of the comiler not allowing us to do it), then I
>would put the operator= as a private method, just as you do in your Fifo
>example. Does this mean that it is then unnecessary to implement the
>operator= at all? I mean, I can understand how it will definitely become
>inaccessible by any derived classes, if any... But the base class will still
>be able to access it. Am I thinking right?
>
>Thanks,

And what will the implementation that you write in the base class
do with your own implemetation, if any, of opertor=?

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-652-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:51:26 2003
Return-Path: <uhcosc1320-return-652-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5pQ5Z1383278
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:51:26 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5pPDI007101
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:51:25 -0500 (CDT)
Received: (qmail 12758 invoked by uid 108); 12 Aug 2003 05:57:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1231 invoked from network); 12 Aug 2003 04:51:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120445.h7C4jsfS1378300@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 23:45:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Can we use one pointer? (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 649
Content-Length: 717
X-Keywords: $NotJunk                                                                                           

>hello... is the stack that we will expect should work in a cylinderical form.. meaning are we supposed to keep track of the bottom and top of the list, or is it a one pointer enough with figuring when the pointer is at 0( meaning empty) or at maxsize (meaning full).. i am asking that because with the code that we got now, a  one pointer is enough but i am afraid of your test code if we need to expect a cylendrical one.. thank you...
>

How you implement it is up to you. Unlike the FiFo queue, stack
is much easier since you pop the last pushed element.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-653-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:52:11 2003
Return-Path: <uhcosc1320-return-653-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5qB5Z1386568
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:52:11 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5qAld029172
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:52:10 -0500 (CDT)
Received: (qmail 13410 invoked by uid 108); 12 Aug 2003 05:57:56 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18663 invoked from network); 12 Aug 2003 05:18:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120512.h7C5CYsb1377382@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:12:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Stack of Stacks (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 650
Content-Length: 437
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I've been busy trying to break my code, and I've come across a problem.  =
>Is it possible to have a Stack of Stacks?  I've tried this line:
>
>Stack<Stack<int>> stkStack(10);
>
>in several variations, but I can't get the compiler to take it.  Should =
>this be a possibility?
>
>Thank you,
>

Are you a mind reader by any chance!.

Try the following
Stack< Stack<int> > stkStack(10);
with a space between the two >.

Venkat

From uhcosc1320-return-654-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:54:37 2003
Return-Path: <uhcosc1320-return-654-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5sb5Z1386806
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:54:37 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5sald029302
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:54:36 -0500 (CDT)
Received: (qmail 15065 invoked by uid 108); 12 Aug 2003 06:00:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9461 invoked from network); 12 Aug 2003 05:04:22 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120458.h7C4wVWS1413552@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 23:58:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assign4 (fwd)
X-Spam-Status: No, hits=0.7 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 651
Content-Length: 2719
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>
>       I used a class A like this
>                class A{    
>                    public:
>                            A(){}
>                              ~A(){}
>                         };
>
>and then in the the main i did this
>
>try
>    {
>        Stack<A> stk3(6);
>        A b,c,d;
>        stk3.push(b);
>        stk3.push(c);
>
>        stk3.pop();
>        cout << stk3.count() << endl;
>
>        stk3.pop();
>        cout << stk3.count() << endl;
>
>    }
>    catch(StackExceptions::StackFull& ex)
>    {
>        cout << "Stack is full. Can hold only " << ex.size() << " elements" <<
> endl;
>    }
>    catch(StackExceptions::StackEmpty&)
>    {
>        cout << "Stack is empty." << endl;
>    }
>
>but if try to use this line
>
>   cout << stk3.pop() << endl;
>
>     to output the objects i pop i am getting two errors.
>
>       C:\Program Files\Microsoft Visual 
>Studio\MyProjects\Assignment4\assign4.cpp(115) : error C2679: binary '<<' : no operator defined which takes a 
>right-hand operand of type 'class A' (or there is no acceptable conversion)
>
>Can u please help me with these two errors.

It should give you those errors, isn't it. The operator<< is not defined
for object of class A. So, that seems reasonable.

>Also i used 
>
>this function 
>
>void print(Stack<int> s)

Do you really want to send a copy of the Stack here? Rule being violated:
never, never pass an object by value. Pass it by reference or
const reference, isn't it?

>{
>    try{
>        Stack<int>stk1(5);
>        stk1 = s;   // s is Stack<int> Stk(6);
>        cout << stk1.pop() << endl;
>        cout << stk1.pop() << endl;
>    }
>    catch(StackExceptions::StackFull& ex)
>    {
>        cout << "Stack is full. Can hold only " << ex.size() << " elements" <<
> endl;
>    }
>    catch(StackExceptions::StackEmpty&)
>    {
>        cout << "Stack is empty." << endl;
>    }
>    
>}
>
>where i create a stack of the same type as " s " and assigning it to stk1 and 
>when i look at the out put it seems to work but in my operator= i didn't 
>compare the sizes of the stack this was my implementation of the operator=
>
>...deleted....
>

So, you are implementing the operator=?  Why is it that FiFo does not
implement operator=? May be there is a reason why the copy constructor
in FiFo is protected and operator= is private.

>is this what u'er looking for or are we supposed to compare the sizes of the 
>stack in the program also are we to execute a statement like the on below.
>...deleted...
>Thank you very much for your insight

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-655-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:55:11 2003
Return-Path: <uhcosc1320-return-655-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5tB5Z1389780
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:55:11 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5tAld029343
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:55:10 -0500 (CDT)
Received: (qmail 15453 invoked by uid 108); 12 Aug 2003 06:00:51 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23315 invoked from network); 12 Aug 2003 05:25:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120519.h7C5JF8H1320498@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:19:15 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Subject: Re: [uhcosc1320] Debug error messages (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 652
Content-Length: 3252
X-Keywords: $NotJunk                                                                                           

>You were correct...that did fix the errors.  My only problem now is where do 
>I deallocate the memory?  I thought that maybe putting it in the pop made 
>sense but you can't deallocate only one space.  You have to deallocate the 
>whole pointer.  So now I am at a roadblock because now I am back where I 
>was.  It works without deallocating memory.  So do I just let the system 
>take care of it on its own and not do anything in the destructor?  If not, 
>can you shed some light again of how and where to take care of the memory 
>properly?
>
>Thank you again,

Well, at the end of my previous email I had mentioned, if you need further help,
you need to email me the project. I can only guess so much without looking
at the code. So, if you send me the code, I can take a look at it for you.

Venkat

>
>
>>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>>To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
>>Subject: [uhcosc1320] Debug error messages (fwd)
>>Date: Mon, 11 Aug 2003 04:30:58 -0500 (CDT)
>>
>> >Dr. Venkat,
>> >
>> >I have submitted my program.  But I was wondering if you can take a look 
>>at
>> >it.  It seems to be doing what it's suppose to so far.  I have not tested 
>>it
>> >extensively yet or cleaned it up, but it seems to work for the most part.
>>
>>Yesterday I sent a code review for some one who had sent it for review.
>>I had mentioned a few things to look out for. I suggest that you
>>take a look at it.
>>
>> >But...I keep getting these "Debug Errors".  I have no idea where to begin 
>>to
>> >fix these errors.  I was wondering if you could shine some light about 
>>these
>> >errors.
>> >
>> >Here are the error messages:  (there's 4 of them)
>> >
>> >1)	Debug Error!
>> >
>> >Program:  …\MVS\My Projects\Assign4\Debug\Assign4.exe
>> >
>> >Damage: after Normal block (#63) at 0x00811DC0.
>> >
>> >
>> >
>> >2)	Debug Assertion Failed!
>> >
>> >Program: …\MVS\My Projects\Assign4\Debug\Assign4.exe
>> >File: dbgheap.c
>> >Line: 1017
>> >
>> >Expression: BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
>> >
>> >3)	Debug Error!
>> >
>> >Program: …\MVS\My Projects\Assign4\Debug\Assign4.exe
>> >
>> >Damage: before (null) block (#-572662307) at 0x00810030.
>> >
>> >4)	Assign4.exe – Application Error
>> >
>> >The instruction at “0x00425933” referenced memory at “0xde5ede0d”. The
>> >memory could not be “read”.
>> >
>> >
>> >Thank you so much for your help,
>>
>>These are generally indicative of problems with trying to
>>delete memory that your program (process) may not own.
>>You may want to take a close look at how you are allocating
>>memory on the heap and how you are cleaning it up.
>>
>>One easy way to find if this is the problem is to comment out
>>the delete(s) from your code and run the program. If it
>>does not give you these errors, it is indicative that the error
>>is caused when you are tyring to delete the heap memory. Then
>>you can take a close look at how you are allocating and deallocating.
>>Try this and if you still can't figure it out, email me your entire
>>project and I will take a look at it for you.
>>
>>Venkat Subramaniam
>>--
>>cosc155g@bayou.uh.edu		Department of Computer Science
>>http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 
>>77204-3475

From uhcosc1320-return-657-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:55:38 2003
Return-Path: <uhcosc1320-return-657-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5tc5Z1279280
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:55:38 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5tbDI007281
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:55:37 -0500 (CDT)
Received: (qmail 16150 invoked by uid 108); 12 Aug 2003 06:01:23 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 26152 invoked from network); 12 Aug 2003 05:29:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120523.h7C5NDRM1226025@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:23:13 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Problem w. pop() function!!! (fwd)
X-Spam-Status: No, hits=1.7 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 653
Content-Length: 995
X-Keywords: $NotJunk                                                                                           

>HI Venkat,
> 
>I'm having some problem w. my pop() func. Looks like it keep giving out the same value of the first poped element. I think there's something wrong w. removing the poped element in the function but I really can't figure it out by myself. So, could you please look at my pop() and tell me what's wrong w. it? here's is my code:
> 
...deleted...
>Notes:  T is a template class.
>Thank you for spending your time. 

Taking a cursory look at your code shows that you are accessing a
variable named top, but top does not change at all. So, each time
it is returning the same value. Easy, take a paper and pensil
and start writing the values of these variables down as if you 
are the computer executing this code. You will figure the problem
out in matter of minutes and you will also have a better understanding
of the logic.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-656-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:55:42 2003
Return-Path: <uhcosc1320-return-656-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5tg5Z1386949
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:55:42 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5tfDI007282
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:55:41 -0500 (CDT)
Received: (qmail 16000 invoked by uid 108); 12 Aug 2003 06:01:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4703 invoked from network); 12 Aug 2003 04:57:02 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120451.h7C4pAkT1381461@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 23:51:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] help with exceptions and namespace (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 654
Content-Length: 961
X-Keywords: $NotJunk                                                                                           

>Could  you please explain how the exceptions work.  I am having a lot of trouble trying to implement this.  In my Stack.h when I throw an exception, I use throw Exceptions::StackFull() or StackEmpty depending on which one I need.  Is this the right way to call it?  
> 
>And when we do the namespace, do we simply say 
>namespace Exceptions{
>class StackFull();
>class StackEmpty():
>}
> 
>if so, why do I keep getting errors.  I don't think we covered this in class, so I was wondering if you could give some more information about this.

StackFull needs to have a function called size() that will tell you what 
the size of the stack was when it threw the exception. The StackFull object 
will carry this information and the code that catches the exception
can print this by calling the size method.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-658-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:56:27 2003
Return-Path: <uhcosc1320-return-658-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5uR5Z1387225
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:56:27 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5uLDI007332
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:56:21 -0500 (CDT)
Received: (qmail 16746 invoked by uid 108); 12 Aug 2003 06:02:07 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16349 invoked from network); 12 Aug 2003 05:15:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120509.h7C59IPT1383988@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:09:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Assignment 4: Extensibility... (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 655
Content-Length: 846
X-Keywords: $NotJunk                                                                                           

>Hello Venkat, this was emailed to you earlier in a previous email about 
>Extensibility. Will you leave the decison up to us about whether to make our 
>stack.h methods virtual or not?

Yep, the decision is yours, but the right to test is mine!

>Also just wondering, if we don't have to make them virtual, how do we 
>ensure(implement) our Stack class can't be inherited by another class? I was 
>not aware there is a way to do this.
>Example)
>
>class Derived : public Stack
>{ ...
>};
>
>Thank you 8o)

Only way to ensure is to make the constructor private, which of course
is not an option in this assignment. So, you better be ready for a test
of inheritance from your Stack class!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-659-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 00:59:54 2003
Return-Path: <uhcosc1320-return-659-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C5xs5Z1385449
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:59:54 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C5xrld029652
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 00:59:53 -0500 (CDT)
Received: (qmail 19126 invoked by uid 108); 12 Aug 2003 06:05:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21602 invoked from network); 12 Aug 2003 05:22:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120516.h7C5Gex81381464@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:16:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] strange prob on Windows XP (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 656
Content-Length: 1255
X-Keywords: $NotJunk                                                                                           

>Hello
> 
>I am facing a strange problem (I am working on Windows XP) while doing Assign 4.
> 
>Every time I make a file named Stack.h,it somehow gets deleted automatically.(I just lost my whole day work!,and it is not there in recycle bin!).
>If I save this file with some other name ,say Stack1.h,it gets saved.
>I have worked on this same system for all my assignments!

You may want to make sure that no one has some kind of a funny program
installed on that system that cleans files named Stack.h!

>When I make the computer search for Stack.h, it goes to some kind of standard system file(which is not my file).
>Is it possible that this system is having some standard file named 'Stack.h' which is clashing with the file made by me.Actually when I had tried to save my file,many a times 
>it had said
>"cannot save ,this file may be in use elsewhere"
>but sometimes,it did save it.
>I am lost.
>please help.
>Eagerly waiting for your response!

You may try rebooting the machine. Also, make sure there is enough
space on the hard drive. Lastly, as I mentioned above, make sure
some one has not installed a program to delete Stack.h on your
system. This may be hard to find actually. Switch to some other
machine if you can and get it done.

Venkat

From uhcosc1320-return-660-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 01:02:10 2003
Return-Path: <uhcosc1320-return-660-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C62A5Z1559041
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 01:02:10 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C624DI007532
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 01:02:09 -0500 (CDT)
Received: (qmail 20636 invoked by uid 108); 12 Aug 2003 06:07:50 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 390 invoked from network); 12 Aug 2003 04:50:26 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120444.h7C4iYPR1386922@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 23:44:34 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] COSC1320 assignment#4 problem (fwd)
X-Spam-Status: No, hits=0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 657
Content-Length: 6342
X-Keywords: $NotJunk                                                                                           

>Hello
> 
>I have a question from the following e-mail.
> 
>May be I am wrong, but aren't the "inner" members of a queue or a stack "inaccessible' or "unmodifiable",otherwise what is the difference between a simple 'array' and a queue.
> 
>If I am in fact wrong,then we may need to overload 'operator[]' too!!
> 
>Regards

The Stack only allows push and pop (plus the other methods that
are stated). Overloading [] is not required for this assignment.

Venkat

>"Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU> wrote:
>>Hello Venkat,
>> I have a problem that I have been trying to solve for the past few 
>>hours, please help.
>>
>>I have been trying out test runs of the stack object of type int, double, 
>>char, objects of a class, char *
>>
>>The problem comes with char * .
>>
>>//////////////////////////////
>>Example)
>>
>>Stack< char * > stack01(5);
>>
>>char tempString[15] = {0};
>>strcpy(tempString, "hello there");
>>
>>stack01.push(tempString); // the string "hello there" is on the stack at 
>>index 0
>>
>>strcpy(tempString, "changed"); //this changes the string to "changed" on 
>>the stack at index 0
>>
>>strcpy(tempString, ""); //now string is "" blank on the stack at index 0
>>///////////////////////////
>>
>>Basically it comes to can we assume you won't change/delete the data pushed 
>>on the stack until it is popped off the stack?
>
>No, but think about it. If a person gets on to a queue or a stack 
>and decides to change name that is fine. For example, there are times
>some one asks you how old you are before you enter a queue say at
>the post office. By the time you get out of the queue, you are much
>older (at least it feels that way at my post office). Objects are
>in the stack. They can change while they are in the stack. That is
>perfectly ok. Just don't delete them while they are in the stack.
>
>>
>>This problem comes with pushing pointers/references.
>>
>
>Good for you. (and it is not a problem after all if you are inline with
>what I am saying above). 
>
>>///////////////////////////
>>Now if we change the above code to below, there is no problem:
>>
>>Stack < char * > stack01(5);
>>
>>stack01.push("hello there");
>>
>>cout << stack01.pop() << endl; //outputs "hello there"
>>
>>///////////////////////////
>>
>>Thank you 8o)
>
>Well, the reason is you are not changing the content after you put it
>in. That is why you are not seeing the problem (if that is a problem at all).
>
>You have answers to questions raised in previous emails. Good job.
>
>Venkat Subramaniam
>-- 
>cosc155g@bayou.uh.edu Department of Computer Science
>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475
>
>
>---------------------------------
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>--0-1300739914-1060635781=:29243
>Content-Type: text/html; charset=us-ascii
>
><DIV>Hello</DIV>
><DIV>&nbsp;</DIV>
><DIV>I have a question from the following e-mail.</DIV>
><DIV>&nbsp;</DIV>
><DIV>May be I am wrong, but aren't the "inner" members of a queue or a stack "inaccessible' or "unmodifiable",otherwise what is the difference between a simple 'array' and a queue.</DIV>
><DIV>&nbsp;</DIV>
><DIV>If I am in fact wrong,then we may need to overload 'operator[]' too!!</DIV>
><DIV>&nbsp;</DIV>
><DIV>Regards</DIV>
><DIV>Hema<BR><BR><B><I>"Dr. Venkat Subramaniam" &lt;cosc155g@Bayou.UH.EDU&gt;</I></B> wrote:</DIV>
><DIV>
><BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid; WIDTH: 100%">&gt;Hello Venkat,<BR>&gt; I have a problem that I have been trying to solve for the past few <BR>&gt;hours, please help.<BR>&gt;<BR>&gt;I have been trying out test runs of the stack object of type int, double, <BR>&gt;char, objects of a class, char *<BR>&gt;<BR>&gt;The problem comes with char * .<BR>&gt;<BR>&gt;//////////////////////////////<BR>&gt;Example)<BR>&gt;<BR>&gt;Stack&lt; char * &gt; stack01(5);<BR>&gt;<BR>&gt;char tempString[15] = {0};<BR>&gt;strcpy(tempString, "hello there");<BR>&gt;<BR>&gt;stack01.push(tempString); // the string "hello there" is on the stack at <BR>&gt;index 0<BR>&gt;<BR>&gt;strcpy(tempString, "changed"); //this changes the string to "changed" on <BR>&gt;the stack at index 0<BR>&gt;<BR>&gt;strcpy(tempString, ""); //now string is "" blank on the stack at index 0<BR>&gt;///////////////////////////<BR>&gt;<BR>&gt;Basically it comes to can we assume!
  !
> you won't
> change/delete the data pushed <BR>&gt;on the stack until it is popped off the stack?<BR><BR>No, but think about it. If a person gets on to a queue or a stack <BR>and decides to change name that is fine. For example, there are times<BR>some one asks you how old you are before you enter a queue say at<BR>the post office. By the time you get out of the queue, you are much<BR>older (at least it feels that way at my post office). Objects are<BR>in the stack. They can change while they are in the stack. That is<BR>perfectly ok. Just don't delete them while they are in the stack.<BR><BR>&gt;<BR>&gt;This problem comes with pushing pointers/references.<BR>&gt;<BR><BR>Good for you. (and it is not a problem after all if you are inline with<BR>what I am saying above). <BR><BR>&gt;///////////////////////////<BR>&gt;Now if we change the above code to below, there is no problem:<BR>&gt;<BR>&gt;Stack &lt; char * &gt; stack01(5);<BR>&gt;<BR>&gt;stack01.push("hello there");<BR>&gt;<BR>&gt;c!
 o!
> ut
> &lt;&lt; stack01.pop() &lt;&lt; endl; //outputs "hello there"<BR>&gt;<BR>&gt;///////////////////////////<BR>&gt;<BR>&gt;Thank you 8o)<BR><BR>Well, the reason is you are not changing the content after you put it<BR>in. That is why you are not seeing the problem (if that is a problem at all).<BR><BR>You have answers to questions raised in previous emails. Good job.<BR><BR>Venkat Subramaniam<BR>-- <BR>cosc155g@bayou.uh.edu Department of Computer Science<BR>http://www.cs.uh.edu/~svenkat University of Houston, Houston, Tx 77204-3475</BLOCKQUOTE></DIV><p><hr SIZE=1>
>Do you Yahoo!?<br>
><a href="http://us.rd.yahoo.com/evt=10469/*http://sitebuilder.yahoo.com">Yahoo! SiteBuilder</a> - Free, easy-to-use web site design software
>--0-1300739914-1060635781=:29243--
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-661-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 01:34:43 2003
Return-Path: <uhcosc1320-return-661-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7C6Yh5Z1392344
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 01:34:43 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7C6Yhld001593
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 01:34:43 -0500 (CDT)
Received: (qmail 7759 invoked by uid 108); 12 Aug 2003 06:40:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7069 invoked from network); 12 Aug 2003 05:49:48 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308120543.h7C5hvBp1376571@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 00:43:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] help on assignment 4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 658
Content-Length: 537
X-Keywords: $NotJunk                                                                                           

>I haven't finished implementing the size method in my stackfull class but other than that, I think that the code should work, but I keep getting errors when I try to compile and they all refer to the exceptions.  Please help.  I think I'm throwing the exceptions correctly and I named the namespace right.......
>

If the code you have sent is what you are using, you may want to
make sure you do not have the class StackFull and StackEmpty 
being defined in Stack.h file. I see these being repeated
at the end of Stack.h file.

Venkat

From uhcosc1320-return-662-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 07:18:37 2003
Return-Path: <uhcosc1320-return-662-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CCIb5Z1354711
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:18:37 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CCIbni001038
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:18:37 -0500 (CDT)
Received: (qmail 5157 invoked by uid 108); 12 Aug 2003 12:24:20 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22470 invoked from network); 12 Aug 2003 12:01:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121155.h7CBtCtU1398565@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 06:55:12 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] copy constructor / assignment operator (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 659
Content-Length: 504
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>The copy constructor should be made protected so it can be use by the 
>inherited classes whereas making the operator= private ensures that no one ever 
>assigns the object to another object.

Sorry, this is not explaining the real "why." It is explaning the
effect of these decisions, but not the reasoning. The bonus is still
open.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-663-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 07:21:42 2003
Return-Path: <uhcosc1320-return-663-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CCLg5Z1400439
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:21:42 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CCLfDI021346
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:21:42 -0500 (CDT)
Received: (qmail 7317 invoked by uid 108); 12 Aug 2003 12:27:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20408 invoked from network); 12 Aug 2003 11:57:32 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121151.h7CBpdm41395828@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 06:51:39 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] linking error (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 660
Content-Length: 538
X-Keywords: $NotJunk                                                                                           

>Hi Venkat
>Cna you plaese help with this linking error.
>Linking...
>LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol 
>_WinMain@16
>Debug/assign4.exe : fatal error LNK1120: 1 unresolved externals
>Error executing link.exe.
>
>assign4.exe - 2 error(s), 0 warning(s)
>
>i've attached a zipped file with the email.
>Thanks

You must have created a windows application instead of a console application.
Create a project as console application and move the files over to the new 
project. The error should go away.

Venkat

From uhcosc1320-return-664-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 07:25:33 2003
Return-Path: <uhcosc1320-return-664-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CCPX5Z1392879
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:25:33 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CCPWni001260
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:25:32 -0500 (CDT)
Received: (qmail 9865 invoked by uid 108); 12 Aug 2003 12:31:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32111 invoked from network); 12 Aug 2003 12:16:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121210.h7CCA8TC1399274@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 07:10:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Why  copy constructor should be protected and  assignment operator a private (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 661
Content-Length: 2387
X-Keywords: $NotJunk                                                                                           

>Hi Dr.Venkat
>The reason why assignment operator should be private
>is that if class A has assignment operator public and
>class B derives from class A then the assignment
>operator of B should be implemented as well as the
>assignment operator of A in the class B ( of course we
>will just call the operator = of A in B but still we
>have to call it). If we have class  C that inherites
>from B then the operator of A B and C have to be
>implemnted in C. So avoid it we make the assignment
>operator private.

Great. Let's read on.

>As far as why copy construtor is made protect, let us
>take the example of Car with Engine and TurboEngine
>which derives from Engine I have a Car with a copy
>construtor which is public as 
>Car (const Car& otherCar)
>{
>...
>pEngine = new Engine(*otherCAr.pEngine);
>}
>If I have another car object which has a turboEngine
>and I make a copy of the car using the copy
>construtor.
>I have a turboEngine which inherites from Engine and I
>ask for an Enigne in my Car copy construtor it will
>give me a Engine in other words in this case I will
>get a Engine, not a turboEngine even if the otherCar
>has a turboEngine. How to solve this? Each time I ask
>for an Engine I need to check if the Engine is Engine
>or turboEngine. This is not extensible as we are
>breaking the code each time a new Engine type is
>introduced . We are breaking OCP here. The way around
>this is for the Engine to decide what kind of Engine
>needs to be sent. Cool!! This works!! But what happens
>when there are const values in the class Engine. They
>are intialized during the creation of the object and
>are not properly assigned during copying. Also the
>methods need to be properly implemented in Engine
>class as no construtor is called on the Engine class
>when a copy is made.By making it protected we are
>allowing the derive class of Engine like turboEngine to
>implement correctly the functionality of Engine but do
>not allow the Car class to make a copy of it.
>
>This is the reason why copy construtor has be made
>protected and assignment operator made a private.
>
>I hope this is the correct answer .OOPs it is a bit
>too long.
>
>Thanks

I will buy that and you are the winner of this bonus point!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-665-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 07:28:30 2003
Return-Path: <uhcosc1320-return-665-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CCSU5Z1403983
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:28:30 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CCSTDI021443
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:28:29 -0500 (CDT)
Received: (qmail 11842 invoked by uid 108); 12 Aug 2003 12:34:11 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 28693 invoked from network); 12 Aug 2003 12:10:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121205.h7CC50fO1364329@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 07:05:00 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Help on error messages (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 662
Content-Length: 1055
X-Keywords: $NotJunk                                                                                           

>This did not help, now I am getting more errors. I want to know if I am using the tempelet right and how to call the function from Stack<MEMBER> class.
>

Just because you are getting more errors, it does not mean what you had
earlier is better. What errors are you getting now? If you send me the
code and describe what errors you are getting, I can be of further help.
I do not keep copies of your original emails to go back and look at
the code you had sent.

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/12/03 12:31 AM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] Help on error messages (fwd)
>
>> 
>> >I am getting the following errors could you please help me:
>>
>>error C2011: 'StackExceptions::StackFull' : 'class' type redefinition
>>...deleted...
>
>There is no reason to include Stack.h in any file other than 
>the assign4.cpp. So remove Stack.h from Exceptions.cpp.
>Stack depends on exceptions. Exceptions do not depend on Stack.
>
>Venkat

From uhcosc1320-return-666-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 07:35:24 2003
Return-Path: <uhcosc1320-return-666-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CCZO5Z1406697
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:35:24 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CCZNni001577
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:35:23 -0500 (CDT)
Received: (qmail 16765 invoked by uid 108); 12 Aug 2003 12:41:09 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21783 invoked from network); 12 Aug 2003 11:59:56 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121154.h7CBs4oG1400275@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 06:54:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] array (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 663
Content-Length: 986
X-Keywords: $NotJunk                                                                                           

>How do you initialize an array in an initilization list.
>
>I was trying it out on another program
>
>Here is the class I wrote
>
>...deleted...
>It gives the following errors
>
>cxx: Error: class.h, line 11: expression must have a constant value
>int array[SIZE];
>----------^
>cxx: Error: class.h, line 14: expected a "("
>          detected during instantiation of "A<M>::A(int) [with M=int]"
>template<class M> A<M>::A(int v):SIZE(v), array[SIZE](v)
>-----------------------------------------------^
>
>
>Can you please help me?

I wouldn't initialize an array in the initialization list.

>I was done with the assignment but I was taking the actual object not the 
>pointers. due to which I was assuming that the class would have the 
>operator=, copy constructor, and default constructor.
>
>Desperately need help thanks

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-667-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 07:43:01 2003
Return-Path: <uhcosc1320-return-667-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CCh15Z1054270
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:43:01 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CCh0ni001878
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:43:00 -0500 (CDT)
Received: (qmail 22575 invoked by uid 108); 12 Aug 2003 12:48:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20427 invoked from network); 12 Aug 2003 12:45:55 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121240.h7CCe2rM1408460@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 07:40:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Big three on exception classes? (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 664
Content-Length: 417
X-Keywords: $NotJunk                                                                                           

>Do we need to follow  the rule of big three in our exception classes?  For Stack empty I don't need any methods or anything else and for Stack full I just have the size method and the constructor.  

So you think you do not have to follow law of big three?!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-668-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 07:52:31 2003
Return-Path: <uhcosc1320-return-668-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CCqV5Z1402695
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:52:31 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CCqUni002204
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:52:30 -0500 (CDT)
Received: (qmail 29427 invoked by uid 108); 12 Aug 2003 12:58:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18770 invoked from network); 12 Aug 2003 12:43:51 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121237.h7CCbwT71393957@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 07:37:58 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] :( sorry ignore first email (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 665
Content-Length: 1667
X-Keywords: $NotJunk                                                                                           

>Ignore my array email ... everything was falling apart when I emailed you 
>last time. As I had just seen that we need an array of pointers, where as I 
>had the actual objects.
>
>I have the following Stack.h and assign4.cpp
>
>The whole thing works fine with my 5 different test senarios one of the 
>senarios is smashing on my head and it is the char one.
>
>when I push more than 1 characters it seems to override the all the previous 
>ones.
>
>can you please look at my code and see what is wrong with it.
>...deleted...

First observation looking at your code, you are very much in the right
direction.

I created a project, copied your code, added Exceptions.h and
removed references to class A (since you did not send me this file).

When I ran, it gave me this for the stack of chars.


TESTING FOR CHAR
calling function**********
What is it i
where is it 002F2A44
What is it a
where is it 002F2A40
2
i:(
a:(
0

instead of what you have said, which is
>TESTING FOR CHAR
>calling function**********
>What is it i
>where is it 0x140006008
>What is it i
>where is it 0x140006000
>2
>i:(
>i:(
>0
>...deleted...
>And I as I mentioned above the problem lies in the testing of char
>
>Can you pleeeeeeeeeeeeaaaaaaaaaaaaasssssse look at that?
>
>
>
>Thank you thank you thank you soooooooo much

I tried on the PC and got the results I had mentioned above.

However, when I ran your code on bayou, it gave a different result,
like the one you have mentioned. Interesting! I will take a look
at it further.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-669-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 07:54:22 2003
Return-Path: <uhcosc1320-return-669-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CCsL5Z1405375
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:54:21 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CCsLDI022198
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 07:54:21 -0500 (CDT)
Received: (qmail 30817 invoked by uid 108); 12 Aug 2003 13:00:02 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 27651 invoked from network); 12 Aug 2003 12:55:53 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121250.h7CCo1201404270@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 07:50:00 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] FOLLOWUP on :( sorry ignore first email
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 666
Content-Length: 1082
X-Keywords: $NotJunk                                                                                           

As I mentioned in my previous email, it worked fine an PC, but
gave incorrect results on bayou.

Here is what I did. I made a slight change in main (on bayou).

>		Stack<char> stk(5);
>		stk.push('a');
>		stk.push('i');

Modified the above two lines to

	char a = 'a';
	char i = 'i';
	stk.push(a);
	stk.push(i);

It worked fine after this. 

I think it is getting messed up when you try to take a pointer for
a const literal as in the code you originally had.

The way the code is implemented, it is not quite intended to
work with stk.push('a'),  or stk.push(1); Even though that is what
is given in the assign4.cpp test case.

For the sake of this assignment, you can assume I will test your
stack by creating variables and pushing them into stack.

For example, even though assing4.cpp has things like
stk.push(1);

I will test it with

int a = 1;
stk.push(a);

You can move on now to review your code and turning it in.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From cosc155g Tue Aug 12 11:54:13 2003
Return-Path: <cosc155g@Bayou.UH.EDU>
Received: from bay.uh.edu (localhost [127.0.0.1])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CGsD5Z1416041
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 11:54:13 -0500 (CDT)
Received: (from cosc155g@localhost)
	by bay.uh.edu (8.12.9/8.12.9/Submit) id h7CGsDa71419653
	for cosc155g@Bayou.UH.EDU; Tue, 12 Aug 2003 11:54:13 -0500 (CDT)
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121654.h7CGsDa71419653@bay.uh.edu>
Subject: Re: [uhcosc1320] Re: Problem with destructor
To: cosc155g@bayou.uh.edu (Dr. Venkat Subramaniam)
Date: Tue, 12 Aug 2003 11:54:13 -0500 (CDT)
In-Reply-To: <200308121643.h7CGh34U1420818@bay.uh.edu> from "Dr. Venkat Subramaniam" at Aug 12, 2003 11:43:03 AM
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Status: O
X-UID: 667
Content-Length: 159
X-Keywords: $NotJunk                                                                                           



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-671-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 12:08:30 2003
Return-Path: <uhcosc1320-return-671-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CH8U5Z1424526
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 12:08:30 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CH8Tuc011831
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 12:08:29 -0500 (CDT)
Received: (qmail 2286 invoked by uid 108); 12 Aug 2003 17:14:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18266 invoked from network); 12 Aug 2003 16:57:48 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121651.h7CGpr721388209@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 11:51:53 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Clarification on Exception Handling on Assign. 4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 668
Content-Length: 2085
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I sent a email about midday yesterday on my exceptions not working properly.  I have not recieved a reply.  Since, I am beating my head against a wall, I am resending my original email.  I am totally clueless as to why my exceptions are not working, can you PLEASE help..
>
>Venkat,
>
>I have a few questions.  The most important to me right now is why my exception handling is not working.  Here is the code I have written that pertains to the problem.  Be aware I have not converted to templates yet.  And, I am only working with integers to make sure my basis is correct before I move on.  Everything compiles and links, but when I run my program it gives me a debug error on the line where I throw my exception for empty stack.  At least that is what it does when I step through the code.
>
>I don't think I am passing the correct thing to the catch.  I have looked at the examples in class on exception handling, I have tried a few things and  I only break it more.
>
>...deleted...
>
>Any help with problems you may see that are not asked about are welcome.

There is nothing wrong with the way you are dealing with exceptions.
There are two significant problems in your code. 

1. You are using new int( instead of new int[. I had pointed this out
in the mail yesterday as well.
2. You are not keeping correct count of the number of elements.
	Note you are using numberofElements to keep track of the
	count and you are also using it to index the array. It is 
	important that you do not step outside the array bounds.

	Once again, I suggest that you take a piece of paper and 
	start writing down the values internal to the stack on the
	paper as you step through the code. This is the best way to
	make sure your logic is correct.
 
>Please help!! I am confusing myself on how all of this works together the more I try and fix my problem.  Any pointer, hints, and/or clarification would be appreciated.
>

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-672-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 12:37:33 2003
Return-Path: <uhcosc1320-return-672-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CHbX5Z1422228
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 12:37:33 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CHbWaG001122
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 12:37:32 -0500 (CDT)
Received: (qmail 29489 invoked by uid 108); 12 Aug 2003 17:43:15 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20810 invoked from network); 12 Aug 2003 16:59:59 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121654.h7CGs5aw1175723@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 11:54:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Visual Studio's ClassView window does not display my methods (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 669
Content-Length: 547
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>When I converted my Stack class into a template, the ClassView stopped displaying my methods.  Is this okay?  My program still works fine.  It is a little unnerving.  I have included my Stack.h file to help you see if I have converted anything wrong....
>...deleted...

I am not sure why the classview does not show things. If all else works
fine, you can ignore that for now.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-673-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 12:45:53 2003
Return-Path: <uhcosc1320-return-673-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CHjr5Z1407940
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 12:45:53 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CHjqaG001376
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 12:45:52 -0500 (CDT)
Received: (qmail 5400 invoked by uid 108); 12 Aug 2003 17:51:35 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2335 invoked from network); 12 Aug 2003 17:48:24 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121742.h7CHgVFu1428805@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 12:42:31 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] FOLLOWUP on :( sorry ignore first email (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 670
Content-Length: 739
X-Keywords: $NotJunk                                                                                           

>Thanks sooooo very much
>But there is one little problem, after I made the change it works fine with 
>char and objects but when I was testing it further with strings it gave the 
>same problem, and eventhough I have separate variables like char string[10]= 
>"hello"; of type char*.I even tried to change it as const char* not that it 
>should make any difference but that doesn't work either.
>
>I am sorry to disturb you again.
>Here is my code for assign4.cpp
>I am not sure if you have my Stack.h
>so I am resending it.
>
>I really appologize for wasting you time again, I should have seen this last 
>night.
>
>Thanks a lot Venkat, I really appreciate for all your help.
>...deleted...

This again seems to work fine on PC.

Venkat

From uhcosc1320-return-674-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 13:04:42 2003
Return-Path: <uhcosc1320-return-674-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CI4g5Z1425425
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:04:42 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CI4fuc014063
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:04:41 -0500 (CDT)
Received: (qmail 23632 invoked by uid 108); 12 Aug 2003 18:10:24 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14422 invoked from network); 12 Aug 2003 18:01:04 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121755.h7CHtAZU1425587@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 12:55:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: [uhcosc1320] Help on error messages (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 671
Content-Length: 1452
X-Keywords: $NotJunk                                                                                           

>Here is the error messages that I am getting now. They are completly different when I take out the #include<Stack.h>. My code is included in a zip format. Thank you for your help Venkat. 
>
>Error Messages:
>c:\Documents and Settings\Administrator\My Documents\School\Cosc1320\assignment3\Exceptions.cpp(19): error C2065: 'Stack' : undeclared identifier
>c:\Documents and Settings\Administrator\My Documents\School\Cosc1320\assignment3\Exceptions.cpp(19): error C2065: 'MEMBER' : undeclared identifier
>c:\Documents and Settings\Administrator\My Documents\School\Cosc1320\assignment3\Exceptions.cpp(19): error C2039: 'getMaxSize' : is not a member of 'operator``global namespace'''
>c:\Documents and Settings\Administrator\My Documents\School\Cosc1320\assignment3\Exceptions.cpp(19): error C2065: 'getMaxSize' : undeclared identifier
>c:\Documents and Settings\Administrator\My Documents\School\Cosc1320\assignment3\Exceptions.cpp(19): warning C4804: '>' : unsafe use of type 'bool' in operation
>

Do the following:

1. Add a constructor to StackFull. This constructor should take an argument of
type int.
2. Within the constructor set a member variable maxSize to the value of the
	constructor argument.
3. In the size method, return this member variable maxSize.
4. In the push method, throw StackFull(max_size); at the appropriate place.

Once again, there should be no reference to Stack within the 
Exceptions.h and Exceptions.cpp file.

Venkat

From uhcosc1320-return-675-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 13:05:52 2003
Return-Path: <uhcosc1320-return-675-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CI5q5Z1415114
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:05:52 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CI5paG002037
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:05:51 -0500 (CDT)
Received: (qmail 25052 invoked by uid 108); 12 Aug 2003 18:11:39 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 22070 invoked from network); 12 Aug 2003 18:08:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121802.h7CI2qov1337730@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 13:02:52 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: RE: [uhcosc1320] operator= (fwd)
X-Spam-Status: No, hits=0.4 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 672
Content-Length: 1567
X-Keywords: $NotJunk                                                                                           

>Can you please rephrase the question asked below: "And what will the implementation that you write in the base class
>do with your own implemetation, if any, of opertor=?"

The person asked if (s)he should implement operator= even though it is
private. Let's assume you implement it. My question is, where would you
be using it and for what?

>Also is the answer to what I think you are asking is that nothing will happen to the implementation of our operator=, if any, because the operator= will be private.
>
>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/12/03 12:07 AM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: RE: [uhcosc1320] operator= (fwd)
>
>> 
>> >Venkat,
>>
>>It seems like since we don't need to worry about mixing types with the
>>assignment operator (b/c of the comiler not allowing us to do it), then I
>>would put the operator= as a private method, just as you do in your Fifo
>>example. Does this mean that it is then unnecessary to implement the
>>operator= at all? I mean, I can understand how it will definitely become
>>inaccessible by any derived classes, if any... But the base class will
>still
>>be able to access it. Am I thinking right?
>>
>>Thanks,
>
>And what will the implementation that you write in the base class
>do with your own implemetation, if any, of opertor=?
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475

From uhcosc1320-return-676-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 13:06:04 2003
Return-Path: <uhcosc1320-return-676-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CI645Z1422977
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:06:04 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CI64aG002050
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:06:04 -0500 (CDT)
Received: (qmail 25296 invoked by uid 108); 12 Aug 2003 18:11:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 20582 invoked from network); 12 Aug 2003 18:07:12 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121801.h7CI1IVe1404257@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 13:01:18 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] errors in assign4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 673
Content-Length: 933
X-Keywords: $NotJunk                                                                                           

>Venkat,
>My program was compiling with no errors until I changed it so that the array would be an array of pointers that would point  to ints, chars, doubles, objects of other classes, and stacks.  Now I am getting quite a few errors.  I've been working on it for a long time.  Could you please help me out? In my push function, it reads "pToObject = &addIn". I get a lot of my errors here where it says that I can not convert from const int* to int*, etc.  While you're looking at my header file, can you please tell me if I actually implemented my array correctly, because I don't feel like I have.  Any other suggestions from you would be wonderful. Thank you.
>The file is attached.

On the line where it gives error, you may change

pToObject = &addIn;

to

pToObject = (MEMBER*) &addIn;

You are keeping multiple pointers to the array. That is totally unnecessary 
and makes this more complicated than it needs to be.

Venkat

From uhcosc1320-return-677-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 13:06:31 2003
Return-Path: <uhcosc1320-return-677-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CI6V5Z1390955
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:06:31 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CI6Uuc014148
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:06:30 -0500 (CDT)
Received: (qmail 25921 invoked by uid 108); 12 Aug 2003 18:12:18 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 8766 invoked from network); 12 Aug 2003 17:55:16 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121749.h7CHnMXK1417247@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 12:49:22 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assign#4 - 102 errors (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 674
Content-Length: 838
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I read your email about the way we're supposed to fix the 102 errors. I tried to use the correct notation from that email and i still get the same errors. what am I doing wrong? Please look at my attached code. Thanks.
>
> 

This has been said a few times already, and I am repeating.
When you are implementing the method of a template class,

instead of writing

Stack<MEMBER>::Stack (int size)
{
...

Write it as

template <class MEMBER>
Stack<MEMBER>::Stack (int size)
{
...

The template <class MEMBER> is needed for each method of the template that 
you implement.

Also, add a method named size in the StackFull class.

Replace 	if (index==stackSize)
		throw StackFull();

with 
	if (index==stackSize)
	throw StackFull(stackSize);

Of course, this will require StackSize to have a constructor that takes an int.

Venkat

From uhcosc1320-return-678-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 13:19:56 2003
Return-Path: <uhcosc1320-return-678-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CIJt5Z1427771
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:19:55 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CIJsuc014781
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 13:19:54 -0500 (CDT)
Received: (qmail 6075 invoked by uid 108); 12 Aug 2003 18:25:37 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17162 invoked from network); 12 Aug 2003 18:03:56 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308121758.h7CHw2xK1416596@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 12:58:02 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] problem breaking Assignment4 with stacks of stacks (fwd)
X-Spam-Status: No, hits=1.2 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 675
Content-Length: 2113
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I have gotten my code to appear like it is working.  On the tests that I have run.  I can not get my code to compile the stacks of stacks that were talked about earlier in an email.  I am also not sure if I am implementing my test for stacks of class objects.  Would you let me know if I am assuming incorrectly or if I am just totally off base with the way my code is written for these two tests.
>
>THIS IS THE CODE FOR TESTING STACKS OF CLASS OBJECTS:
>
>	try
>	{
>		Stack<A> stk(2);
>
>		A x,y,z;
>		A& ptr1 = x;
>		A& ptr2 = y;
>		A& ptr3 = z;
>		
>		stk.push(ptr1);
>		stk.push(ptr2);

I would expect to call 

stk.push(x);
stk.push(y);

>		//stk.push(ptr3);
>		//stk.push(4);
>		//stk.push(5);
>		//stk.push(6);
>
>
>		stk.pop();
>		cout << stk.count() << endl;
>
>		stk.pop();
>		cout << stk.count() << endl;
>
>		stk.pop();
>	}
>	catch(StackExceptions::StackFull& ex)
>	{
>		cout << "Stack if full. Can hold only " << ex.size() << " elements" << endl;
>	}
>	catch(StackExceptions::StackEmpty&)
>	{
>		cout << "Stack if empty." << endl;
>	}
>	
>THIS IS THE CODE FOR TESTING STACKS OF STACKS:
>
>	try
>	{
>		Stack< Stack<char> > stk(2);
>
>		Stack<char> stk1 (5), stk2 (10), stk3 (3);
>		Stack<char>& ptra1 = stk1(5);
>		Stack<char>& ptrb2 = stk2(10);
>		Stack<char>& ptrc3 = stk3(3);
>		//Stack<char> stk2 (10);
>		//Stack<char> stk3 (3);
>		
>		stk.push(ptra1);

Again, here I would expect to call

stk.push(stk1);
stk.push(stk2);
...

>		stk.push(ptrb2);
>		//stk.push(&stk3);
>		//stk.push(4);
>		//stk.push(5);
>		//stk.push(6);
>
>
>		stk.pop();
>		cout << stk.count() << endl;
>
>		stk.pop();
>		cout << stk.count() << endl;
>
>		stk.pop();
>	}
>	catch(StackExceptions::StackFull& ex)
>	{
>		cout << "Stack if full. Can hold only " << ex.size() << " elements" << endl;
>	}
>	catch(StackExceptions::StackEmpty&)
>	{
>		cout << "Stack if empty." << endl;
>	}
>
>I HAVE ALSO INCLUDE MY STACK.H FILE IF YOU NEED IT.
>
>...deleted...

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-679-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:19:59 2003
Return-Path: <uhcosc1320-return-679-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMJx5Z1448902
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:19:59 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMJwaG011335
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:19:59 -0500 (CDT)
Received: (qmail 748 invoked by uid 108); 12 Aug 2003 22:25:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32726 invoked from network); 12 Aug 2003 22:25:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122219.h7CMJKIM1446581@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:19:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] errors in assign4 again (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 676
Content-Length: 673
X-Keywords: $NotJunk                                                                                           

>I have attached a copy of my stack.h.  I fixed the line you had previously told me to but the errors are still there.  On the line that reads "pElement[lastIn] = (MEMBER*) &addIn" in my push function, I get errors regarding conversion and binary =, no operator defined....Also, what did you mean when you said I was keeping multiple pointers to an array which is unnecessary?  I  thought to hold objects of different class or to hold other stacks we would have ot use pointers in the array.  Am I completely lost???
>

All that you need is one array of pointers. That's it. I see no
reason for you to have more than one pointer of MEMBER or 
MEMBER* in your code.

Venkat

From uhcosc1320-return-680-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:21:29 2003
Return-Path: <uhcosc1320-return-680-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMLT5Z1122191
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:21:29 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMLSaG011381
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:21:29 -0500 (CDT)
Received: (qmail 1938 invoked by uid 108); 12 Aug 2003 22:27:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29111 invoked from network); 12 Aug 2003 22:20:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122214.h7CMEkbW1436017@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:14:46 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator= for StackEmpty (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 677
Content-Length: 1381
X-Keywords: $NotJunk                                                                                           

>I was creating a method for operator= for StackEmpty just to follow the Big-3 and my interface for it is :
>...deleted...
>the implementation for it is :
>...deleted...
>
>When I try to run it, I get 5 errors telling me the following. I tried to follow the format of previous operator= created, even the one for the Stack class, but I can't figure out why I am getting these errors.  Can you please advise.  Thanks so much.
>
>error C2143: syntax error : missing ';' before '&'
>error C2734: 'StackEmpty' : const object must be initialized if not extern
>error C2501: '=' : missing storage-class or type specifiers
>error C2556: 'int &__thiscall StackExceptions::StackEmpty::operator =(const class StackExceptions::StackEmpty &)' : overloaded function differs only by
>return type from 'const class StackExceptions::StackEmpty &__thiscall StackExceptions::StackEmpty::operator =(const class StackExceptions::StackEmpty &)'
>see declaration of '='
>error C2373: '=' : redefinition; different type modifiers
>see declaration of '='

You may want to make sure the following:

1. The methods are declared public in the class.
2. The signature and return type of the methods are the same both in the
	header and the .cpp file.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-681-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:24:00 2003
Return-Path: <uhcosc1320-return-681-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMO05Z1430944
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:24:00 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMNxuc024578
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:23:59 -0500 (CDT)
Received: (qmail 4278 invoked by uid 108); 12 Aug 2003 22:29:48 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31016 invoked from network); 12 Aug 2003 22:23:16 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122217.h7CMHLCN1447751@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:17:21 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] REMOVING when POP'd (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 678
Content-Length: 309
X-Keywords: $NotJunk                                                                                           

>Dear venkat,
> 
> 
>i was wondering when i 'pop', should i REMOVE the element?
>or simply make it null?
>

That's up to your implementation decision.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-682-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:24:47 2003
Return-Path: <uhcosc1320-return-682-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMOl5Z1427419
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:24:47 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMOkuc024603
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:24:46 -0500 (CDT)
Received: (qmail 4989 invoked by uid 108); 12 Aug 2003 22:30:30 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30404 invoked from network); 12 Aug 2003 22:22:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122216.h7CMGawi1429764@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:16:36 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] problem breaking Assign.4 with stack of stacks (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 679
Content-Length: 862
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>When I changed my code to accomidate for the hints you gave me, I get an error "cannot access protected member".  I realize that protected means that only the class with the protected method and those classes that inheriate from that class have access to that method.  Therefore, what I am doing in main is obviously suppose to fail.  However, I am not sure what I am suppose to do to fix this problem.  If I unprotect it I get lots of failures.  I am sure it is suppose to be protected.  More over you have said point blank it is suppose to be protected.  What am I missing?
>...deleted...

Remember,

Thou shalt not pass objects by value, but pass only by reference or 
const reference. :)

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-334-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Jul 29 07:09:05 2003
Return-Path: <uhcosc1320-return-334-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by Bayou.UH.EDU (8.12.9/8.12.9) with SMTP id h6TC955Z1247512
	for <cosc155g@bayou.uh.edu>; Tue, 29 Jul 2003 07:09:05 -0500 (CDT)
Received: (qmail 24207 invoked by uid 108); 29 Jul 2003 12:13:40 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23354 invoked from network); 29 Jul 2003 12:12:46 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200307291208.h6TC84lU1239438@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 29 Jul 2003 07:08:04 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] global vs. member (fwd)
Status: O
X-UID: 680
Content-Length: 2531
X-Keywords: $NotJunk                                                                                           

>Dr. Venkat,
>
>1) I am having trouble differentiating between when you must overload an operator using a global function or a member function.  
>
>I think you must use a global function to overload when you are overloading an operator that is already defined such as >> and <<.  Is this correct?

Not exactly. Read on.

>I am not sure about when to use a member function or when you can use either and   how you decide which one to use.  
>

This is very simple. Let's say there is a class A. Assume either you
own this class or you have to right to modify this class.

Assume also that I have a class B. You do not have the rigth to modify class B.
You can use it, however.

Now, you want to write

objA + objB;

For this you need to overload operator+.

The compiler will look for two things:

1. objA.operator+(objB);
2. operator+(objA, objB);

In other words, compiler wants to see if the overloaded operator is a
member or global. 

If it has to be a member, it has to be a member of the class A (object
of which is the left operand in the above example).

So, do you have the right to make this a member of A. You do and 
so you can write this as a member.

Now, you want to do the following:

objA + 2;

Can this be implemented as a member of A?

Yes again.

Now, let's say you want to write

2 + objA;

Well, if this has to be a member, it will have to be a member of int.
However, int is not a class. So, only option here is global. 

Now, let's say, you want

objB + objA;

If this has to be implemented as a member, it must be part of class B.
But, you do not have the right to modify B. So, it can be implemented
by you only as global.

>2) A question from an old test I am having trouble with:
>
>void f1()
>{
>X obj;
>X* ptr=new X();
>throw "error";
>}
>
>what happens to the two objects created?  I have no idea, can you give me a clue?  does is have something to do with the assignment operator and memory leak?
>

You are almost there.

obj is destroyed properly because it is on the stack. The object 
created on heap is not destroyed since delete was not called.

>3)  How do you make sure that a function does not throw an unexpected exception?
>
>Thank You,

You can not. However, you can catch any exception thrown by a function
by using 

catch(...)

as in

try
{
	function();
}
catch(...)
{
	// Here you caught what ever was thrown by function.
}

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-640-cosc155g=bayou.uh.edu@agiledeveloper.com Mon Aug 11 13:37:39 2003
Return-Path: <uhcosc1320-return-640-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7BIbd5Z1319039
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 13:37:39 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7BIbcDI014023
	for <cosc155g@bayou.uh.edu>; Mon, 11 Aug 2003 13:37:39 -0500 (CDT)
Received: (qmail 23931 invoked by uid 108); 11 Aug 2003 18:43:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2758 invoked from network); 11 Aug 2003 18:21:29 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308111815.h7BIFfux1348818@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Mon, 11 Aug 2003 13:15:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] operator= (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 681
Content-Length: 896
X-Keywords: $NotJunk                                                                                           

>I know you have said alot about operator= but I had a question.  Suppose we have two Stack objects such as obj1 (array of ints) and obj2(array of chars).  if we do obj1=obj2, do you want us to send a message stating theres two different types.  If so, do we use dynamic casting to see what the type of the array is?  And suppose that obj1 and obj2 were different lengths but same types, do you want us to send a message that the array length is different and so we cannot continue on with the operator=?  Thanks again.

Since Stack<int> and Stack<char> are two different types when instantiated,
an assignment on objects of these two types should give you a compilation
error. No need to worry about this one where you are mixing types.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-683-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:32:11 2003
Return-Path: <uhcosc1320-return-683-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMWB5Z1436550
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:32:11 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMWAaG011688
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:32:10 -0500 (CDT)
Received: (qmail 10952 invoked by uid 108); 12 Aug 2003 22:37:54 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 7746 invoked from network); 12 Aug 2003 22:33:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122227.h7CMRt4V1440892@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:27:55 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] copy consturctor test (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 682
Content-Length: 362
X-Keywords: $NotJunk                                                                                           

>hello Venkat,
> 
>        I have done most of my coding but I have no ideas to check my copy constructor. Could you please tell me how to test my copy consturctor in main? Thanks!
> 

That's easy. Simly write a class that inherits from your Stack class.
Then make a copy of the derived class object! This should invoke the
copy constructor of the base!

Venkat

From uhcosc1320-return-684-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:32:26 2003
Return-Path: <uhcosc1320-return-684-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMWQ5Z1446030
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:32:26 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMWPaG011697
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:32:25 -0500 (CDT)
Received: (qmail 11356 invoked by uid 108); 12 Aug 2003 22:38:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 2835 invoked from network); 12 Aug 2003 22:28:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122222.h7CMMEAt1449024@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:22:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] trial test code question (fwd)
X-Spam-Status: No, hits=-0.5 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 683
Content-Length: 1191
X-Keywords: $NotJunk                                                                                           

>Hi venkat
>Should the following code result in a compilation error or work fine.
>I have a problem with the stk.pop().pop(); line.
>
>Thanks
>try
>	{
>
>		Stack< Stack<char> > stk(2);
>		Stack<char> stk1 (5), stk2 (10), stk3 (3);
>		Stack<char>& ptra1 = stk1;
>		Stack<char>& ptrb2 = stk2;
>		Stack<char>& ptrc3 = stk3;
>		char a='a';
>		stk1.push(a);
>		char b='b';
>		stk2.push(b);
>
>		stk.push(ptra1);
>		stk.push(ptrb2);
>
>		cout<<stk.pop().pop()<<endl; //this is where my concern is
>                                                                             
>//shouldn't this just print 'b' on the screen

I think it should return b, as well.

>//but it gives me following compilation erro
>/*cxx: Error: assign4.cpp, line 213: the object has type qualifiers that are
>          not compatible with the member function
>                cout<<stk.pop().pop()<<endl;
>----------------------^
>*/
>...deleted...
>
>//Is it okay to get error or there is something wrong with my syntax or 
>program
>// Thanks
>//Best Regards

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-685-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:33:31 2003
Return-Path: <uhcosc1320-return-685-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMXV5Z1429732
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:33:31 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMXUaG011730
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:33:30 -0500 (CDT)
Received: (qmail 12244 invoked by uid 108); 12 Aug 2003 22:39:19 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 6411 invoked from network); 12 Aug 2003 22:32:10 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122226.h7CMQEon1429223@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:26:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] HELP: assign4 error out of nowhere (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 684
Content-Length: 983
X-Keywords: $NotJunk                                                                                           

>I was playing with my stack class to see if I could have an array of pointers in my stack.  it gave me errors and I tried to undo it all, but now, I get errors i didn't get before.  I get errors in my constructor, but i'm not sure why. I didn't get any errors before, and I tried to rebuild all, but that doesn't help. I seem to get an error when in my main i say "Stack < Stack<int> > stk;"  If i comment out the line, everything is okay, but when I don't have it commented out, I get an error.  Before I didnt' have any problems with this line of code.  Attached is the Stack.h and the exceptions  zipped up.  Please help.  Urgently needing your help.  Thanks again.


The error you are getting is in line with what I would expect to see
if the code is written the way it is written. You do not even have
to try some thing as complicated as a Stack of Stack. Simply try
to create a Stack of class X, where X has only one constructor which
takes say an int as an argument.

Venkat

From uhcosc1320-return-686-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:34:45 2003
Return-Path: <uhcosc1320-return-686-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMYj5Z1444595
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:34:45 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMYdaG011786
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:34:44 -0500 (CDT)
Received: (qmail 13373 invoked by uid 108); 12 Aug 2003 22:40:28 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 29602 invoked from network); 12 Aug 2003 22:21:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122215.h7CMFXZX1383899@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:15:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] problem breaking Assignment4 with stacks of stacks (fwd)
X-Spam-Status: No, hits=1.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 685
Content-Length: 3124
X-Keywords: $NotJunk                                                                                           

>I tried the way you did the stack of stacks like this:
>stk.push(stk1);
>stk.push(stk2);
>  but I get errors about the copy constructor being protected?  Should I pass by reference/pointers? Thanks.
>

Remember one of the golden rules: never, never pass an object by value,
pass it by reference or const reference!

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/12/03 12:58 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] problem breaking Assignment4 with stacks of stacks (fwd)
>
>> 
>> >Venkat,
>>
>>I have gotten my code to appear like it is working.  On the tests that I
>have run.  I can not get my code to compile the stacks of stacks that were
>talked about earlier in an email.  I am also not sure if I am implementing
>my test for stacks of class objects.  Would you let me know if I am
>assuming incorrectly or if I am just totally off base with the way my code is
>written for these two tests.
>>
>>THIS IS THE CODE FOR TESTING STACKS OF CLASS OBJECTS:
>>
>>   	try
>>   	{
>>   	   	Stack<A> stk(2);
>>
>>   	   	A x,y,z;
>>   	   	A& ptr1 = x;
>>   	   	A& ptr2 = y;
>>   	   	A& ptr3 = z;
>>   	   	
>>   	   	stk.push(ptr1);
>>   	   	stk.push(ptr2);
>
>I would expect to call 
>
>stk.push(x);
>stk.push(y);
>
>>   	   	//stk.push(ptr3);
>>   	   	//stk.push(4);
>>   	   	//stk.push(5);
>>   	   	//stk.push(6);
>>
>>
>>   	   	stk.pop();
>>   	   	cout << stk.count() << endl;
>>
>>   	   	stk.pop();
>>   	   	cout << stk.count() << endl;
>>
>>   	   	stk.pop();
>>   	}
>>   	catch(StackExceptions::StackFull& ex)
>>   	{
>>   	   	cout << "Stack if full. Can hold only " << ex.size() << " elements" <<
>endl;
>>   	}
>>   	catch(StackExceptions::StackEmpty&)
>>   	{
>>   	   	cout << "Stack if empty." << endl;
>>   	}
>>   	
>>THIS IS THE CODE FOR TESTING STACKS OF STACKS:
>>
>>   	try
>>   	{
>>   	   	Stack< Stack<char> > stk(2);
>>
>>   	   	Stack<char> stk1 (5), stk2 (10), stk3 (3);
>>   	   	Stack<char>& ptra1 = stk1(5);
>>   	   	Stack<char>& ptrb2 = stk2(10);
>>   	   	Stack<char>& ptrc3 = stk3(3);
>>   	   	//Stack<char> stk2 (10);
>>   	   	//Stack<char> stk3 (3);
>>   	   	
>>   	   	stk.push(ptra1);
>
>Again, here I would expect to call
>
>stk.push(stk1);
>stk.push(stk2);
>...
>
>>   	   	stk.push(ptrb2);
>>   	   	//stk.push(&stk3);
>>   	   	//stk.push(4);
>>   	   	//stk.push(5);
>>   	   	//stk.push(6);
>>
>>
>>   	   	stk.pop();
>>   	   	cout << stk.count() << endl;
>>
>>   	   	stk.pop();
>>   	   	cout << stk.count() << endl;
>>
>>   	   	stk.pop();
>>   	}
>>   	catch(StackExceptions::StackFull& ex)
>>   	{
>>   	   	cout << "Stack if full. Can hold only " << ex.size() << " elements" <<
>endl;
>>   	}
>>   	catch(StackExceptions::StackEmpty&)
>>   	{
>>   	   	cout << "Stack if empty." << endl;
>>   	}
>>
>>I HAVE ALSO INCLUDE MY STACK.H FILE IF YOU NEED IT.
>>
>>...deleted...
>
>Venkat Subramaniam
>--   	   	   	   	
>cosc155g@bayou.uh.edu   	   	Department of Computer Science
>http://www.cs.uh.edu/~svenkat    	University of Houston, Houston, Tx
>77204-3475

From uhcosc1320-return-687-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:42:56 2003
Return-Path: <uhcosc1320-return-687-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMgu5Z1441296
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:42:56 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMgtaG012044
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:42:55 -0500 (CDT)
Received: (qmail 19784 invoked by uid 108); 12 Aug 2003 22:48:43 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 10111 invoked from network); 12 Aug 2003 22:36:54 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122230.h7CMUxjM1448504@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:30:59 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] Debug error messages (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 686
Content-Length: 642
X-Keywords:                                                                                                    

>Here's the code.  I didn't know what format you wanted it.  I had submitted 
>the latest version and thought that you would take a look at that one.  Here 
>is a text copy of it.  If you need it in some other format, please let me 
>know.
>
>Thank you,

You will zip the following files into assign4.zip:
Exceptions.h
Exceptions.cpp
Stack.h

Easiest way to zip is to use winzip. Put these three files in a
directory named assign4. Then right click on assign4 directory 
and click on Add to assign4.zip.

Then turnin the assign4.zip by going through the online submission
page at http://www.cs.uh.edu/~svenkat/summer2003.

That's it!

Venkat

From uhcosc1320-return-688-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:44:46 2003
Return-Path: <uhcosc1320-return-688-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMik5Z1450201
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:44:46 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMijaG012106
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:44:45 -0500 (CDT)
Received: (qmail 21349 invoked by uid 108); 12 Aug 2003 22:50:34 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19330 invoked from network); 12 Aug 2003 22:48:11 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122242.h7CMgGtP1413192@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:42:16 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] operator= for StackEmpty (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 687
Content-Length: 436
X-Keywords: $NotJunk                                                                                           

>I've checked it and its public, and the signature and return type look okay, but I still have the same problem.
>
>interface:
>
>namespace StackExceptions{
>	
>...deleted...
>
>implementation:
>
>const StackEmpty& StackExceptions::StackEmpty::operator=(const StackEmpty& other){}

The method operator= requires a return value. You have left its implementation
with {}.

>Anything else i may be missing?  Thanks again very much

Venkat

From uhcosc1320-return-689-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:45:45 2003
Return-Path: <uhcosc1320-return-689-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMji5Z1445352
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:45:44 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMjiaG012139
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:45:44 -0500 (CDT)
Received: (qmail 22177 invoked by uid 108); 12 Aug 2003 22:51:33 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16336 invoked from network); 12 Aug 2003 22:44:18 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122238.h7CMcNjN1400208@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:38:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] DEBUG error on Assign #4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 688
Content-Length: 1050
X-Keywords: $NotJunk                                                                                           

>Venkat,
> 
>I am having similar problems as some students have stated in the last
>few hours. 
> 
>My project is in the pre-template stage, and I am only working with
>ints.
> 
>The problem comes when the destructor is called in the second try
>block.when the Stack is full.
> 
>I have made the appropriate changes to assign4.cpp to handle only
>integers and also to my header file to move around the stack using
>indices.
> 
>Attached you will find my files.
> 
>Thanks for all your help!!
> 
>Best regards,

You have

	topOfStack++;
	pElements[topOfStack]=value;

You are first incrementing the top and then setting. Is it possible
that when the stack size (that is number of elements in stack) is one less 
than its capacity, it will actually put the value in a position outside
of the array bounds?

Shouldn't it be

	pElements[topOfStack]=value;
	topOfStack++;

Again, pick a piece of paper and start writing things down.
For each method you call, on the paper write the values. You will
see the logic (or the error in it) pretty soon.

Venkat

From uhcosc1320-return-690-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 17:47:50 2003
Return-Path: <uhcosc1320-return-690-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7CMlo5Z1436325
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:47:50 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7CMlnuc025423
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 17:47:49 -0500 (CDT)
Received: (qmail 23954 invoked by uid 108); 12 Aug 2003 22:53:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 18223 invoked from network); 12 Aug 2003 22:46:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308122240.h7CMemsp1436335@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 17:40:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] about assign4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 689
Content-Length: 1018
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>As you answered to one of the e-mail that:
>"Objects are in the stack. They can change while they are in the stack. That 
>is
>perfectly ok. Just don't delete them while they are in the stack."
>For my understanding ( may be wrong) is to be able to change the object that 
>is already in the stack. I have the method:
>
>template <class MEMBER>
>MEMBER& Stack<MEMBER>::getElement(int index) const
>{
>    return pElements[index];
>}

No need for such methods.

>and here are my push and pop methods:
>...deleted...
>I am not sure if I am on the right direction ( because you also said don't 
>write a method if not necessary) ?
>or should I just work on the push and pop methods to be able to change the 
>object in the stack ? 
> Would you please advise? 
>Appriatiate your help. 

In main, if I create an object obj and push it, I still have 
obj with me in main. I can call methods on obj to modify its
contents, right. So while obj is in the Stack (it has been pushed),
I can still change it.

Venkat

From uhcosc1320-return-691-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:31:47 2003
Return-Path: <uhcosc1320-return-691-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1Vl5Z1453930
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:31:47 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1Vkuc001095
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:31:47 -0500 (CDT)
Received: (qmail 6333 invoked by uid 108); 13 Aug 2003 01:37:36 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17140 invoked from network); 13 Aug 2003 01:03:33 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130057.h7D0vcUO1445292@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 19:57:38 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] assignment 4 - vector instead of array of pointers (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 690
Content-Length: 515
X-Keywords: $NotJunk                                                                                           

>Hi Dr. Venkat,
>I am using stl vector data structure to hold the
>values of the MEMBER values instead of arrray of
>pointer . Is that ok ? Since we did not deal with STL
>much in the class I am not sure if that is valid.
>Thanks

It's your implementation. You have the freedom to implement it
the way you want, as long as the behavior is what is expected.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-692-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:33:37 2003
Return-Path: <uhcosc1320-return-692-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1Xb5Z1409918
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:33:37 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1XaaG017215
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:33:36 -0500 (CDT)
Received: (qmail 7693 invoked by uid 108); 13 Aug 2003 01:39:26 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 32128 invoked from network); 13 Aug 2003 00:37:22 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130031.h7D0VQMm1450039@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 19:31:26 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment Four: Virtual Functions and other pointless stuff (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 691
Content-Length: 798
X-Keywords: $NotJunk                                                                                           

>Thank you Venkat for you previous help, but I have two more questions:
>
>Do we need virtual functions. Can a user inherit from the stack class. if so what functions can be overiden. will you do this in your test? 
>

Either your class is inheritable or not. If it is inheritable, then
yes, someone could write code or test case to inherit from your class.

>Will a user have a access to the variable that handles the Maximum size of the stack. For example can a user call a method to read and write(change, since initalation) the  Maximum size of the stack variable?

The maximum size of the stack is not modified once it is initialized.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-693-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:33:52 2003
Return-Path: <uhcosc1320-return-693-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1Xp5Z1268112
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:33:51 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1Xpuc001205
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:33:51 -0500 (CDT)
Received: (qmail 7932 invoked by uid 108); 13 Aug 2003 01:39:41 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 17722 invoked from network); 13 Aug 2003 01:04:21 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130058.h7D0wPxv1446351@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 19:58:25 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Can we put the operator= in the exceptions classes "private"???? (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 692
Content-Length: 299
X-Keywords: $NotJunk                                                                                           

>HI Venkat,
>I've read couples of emails about the operator= for the exception classes but I still wondering if we can put them in "private" by then we can just "forget it!" as you said in class and we can have a good sleep tonite? 
> 
>Thanks for your time!

Sounds like a good idea to me.

Venkat

From uhcosc1320-return-694-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:34:33 2003
Return-Path: <uhcosc1320-return-694-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1YX5Z1451463
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:34:33 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1YWuc001258
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:34:32 -0500 (CDT)
Received: (qmail 8321 invoked by uid 108); 13 Aug 2003 01:40:12 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19322 invoked from network); 13 Aug 2003 01:06:43 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130100.h7D10mPp1457627@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 20:00:48 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] return type of pop method: const MEMBER& or MEMBER& (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 693
Content-Length: 887
X-Keywords: $NotJunk                                                                                           

>Dear Venkat,
>
>Let's say I have a stack of cars and I want to set the color to red of the 
>next car I pop from the stack.
>
>This would require the return type of pop method to be MEMBER& instead of 
>const MEMBER&. But I am wondering if it is bad to give someone the ability 
>to change the object he pops from the stack.
>
>I would like to hear your comments on this. Thanks,

A stack simply is a collection. It does not itself change any thing.
The receiver can do what he wants with it. 

If you want to stack which will not allow people to modify the 
objects once they are poped, then I suggest you instantiate 
a Stack of const objects!

So, to answer your question, I would not expect the return of pop to
be a const.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-695-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:36:40 2003
Return-Path: <uhcosc1320-return-695-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1ae5Z1442667
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:36:40 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1aduc001364
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:36:39 -0500 (CDT)
Received: (qmail 9765 invoked by uid 108); 13 Aug 2003 01:42:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16677 invoked from network); 13 Aug 2003 01:02:37 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130056.h7D0ufET1455846@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 19:56:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] trouble with finding out reason for constructor mismatch. (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 694
Content-Length: 752
X-Keywords: $NotJunk                                                                                           

>I'm trying to push a stack of classes but the compiler is complaining of
>"no suitable constructor"
>
>
>	try
>	{		
>		Stack< Stack<char> > stk(2);
>		Stack<char> stk1 (5);
>		Stack<char> stk2 (6);
>		Stack<char> stk3 (3);
>
>		//Stack<char> stk2 (10);
>		//Stack<char> stk3 (3);
>		
>		stk.push(stk1);
>
>		stk.push(stk2);
>		//stk.push(&stk3);
>		//stk.push(4);
>		//stk.push(5);
>		//stk.push(6);
>	....
>	}
>
>below is a complete compiler output; my code is attached. Thanks ;)
>

As mentioned in previous email, try some thing simpler.

Write a class X with one constructor that takes an int.

Then create a Stack of X and push and object of X.

Now, make your code work for that one, then it becomes easier to
push a Stack onto a Stack.

Venkat

From uhcosc1320-return-696-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:37:45 2003
Return-Path: <uhcosc1320-return-696-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1bj5Z1456277
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:37:45 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1biuc001416
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:37:44 -0500 (CDT)
Received: (qmail 10508 invoked by uid 108); 13 Aug 2003 01:43:29 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15741 invoked from network); 13 Aug 2003 01:01:09 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130055.h7D0tEmT1450292@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 19:55:14 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: Re: [uhcosc1320] operator= for StackEmpty (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 695
Content-Length: 954
X-Keywords: $NotJunk                                                                                           

>But since stackEmpty does not have any variables or such, can we just have it be a void instead of return something?  Will that be sufficient?  Thanks

Note that the standard operator= for a class A is of the form

const A& operator=(const A& other);

>
>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/12/03 05:42 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: Re: [uhcosc1320] operator= for StackEmpty (fwd)
>
>> 
>> >I've checked it and its public, and the signature and return type look
>okay, but I still have the same problem.
>>
>>interface:
>>
>>namespace StackExceptions{
>>   	
>>...deleted...
>>
>>implementation:
>>
>>const StackEmpty& StackExceptions::StackEmpty::operator=(const
>StackEmpty& other){}
>
>The method operator= requires a return value. You have left its
>implementation
>with {}.
>
>>Anything else i may be missing?  Thanks again very much
>
>Venkat

From uhcosc1320-return-697-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:38:37 2003
Return-Path: <uhcosc1320-return-697-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1cb5Z1455234
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:38:37 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1caaG017447
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:38:36 -0500 (CDT)
Received: (qmail 11182 invoked by uid 108); 13 Aug 2003 01:44:21 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 14923 invoked from network); 13 Aug 2003 01:00:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130054.h7D0sBPh1450599@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 19:54:11 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] about assign4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 696
Content-Length: 1708
X-Keywords: $NotJunk                                                                                           

>But you do not mean literally
>
>Stack<int> stk(10)
>
>Stk[1] = 5 ?
>
>If not, what you mean is that you can change the object after being
>passed but what was changed in main is not affected by the object
>already pushed onto the stack. (since it was pushed by "value")

Here is what I mean.

Stack<X> stk(2);
X obj;
obj.setValue(2);

stk.push(obj);
obj.setValue(3);

X& object = stk.pop();
object.getValue(); // This should return 3 and not 2.

>
>
>-----Original Message-----
>From: Dr. Venkat Subramaniam [mailto:cosc155g@Bayou.UH.EDU] 
>Sent: Tuesday, August 12, 2003 5:41 PM
>To: COSC 1320 Mailing List
>Subject: [uhcosc1320] about assign4 (fwd)
>
>>Hi, Venkat
>>As you answered to one of the e-mail that:
>>"Objects are in the stack. They can change while they are in the stack.
>That 
>>is
>>perfectly ok. Just don't delete them while they are in the stack."
>>For my understanding ( may be wrong) is to be able to change the object
>that 
>>is already in the stack. I have the method:
>>
>>template <class MEMBER>
>>MEMBER& Stack<MEMBER>::getElement(int index) const
>>{
>>    return pElements[index];
>>}
>
>No need for such methods.
>
>>and here are my push and pop methods:
>>...deleted...
>>I am not sure if I am on the right direction ( because you also said
>don't 
>>write a method if not necessary) ?
>>or should I just work on the push and pop methods to be able to change
>the 
>>object in the stack ? 
>> Would you please advise? 
>>Appriatiate your help. 
>
>In main, if I create an object obj and push it, I still have 
>obj with me in main. I can call methods on obj to modify its
>contents, right. So while obj is in the Stack (it has been pushed),
>I can still change it.
>
>Venkat

From uhcosc1320-return-698-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:40:09 2003
Return-Path: <uhcosc1320-return-698-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1e95Z1445156
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:40:09 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1e9uc001554
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:40:09 -0500 (CDT)
Received: (qmail 12339 invoked by uid 108); 13 Aug 2003 01:45:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 4891 invoked from network); 13 Aug 2003 01:35:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130129.h7D1TKuu1449984@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 20:29:20 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] array of pointers (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 697
Content-Length: 848
X-Keywords: $NotJunk                                                                                           

>I tried to implement the array of pointers in my Stack class as follows.
>
...deleted...
>where the constructor and push methods of Stack are :
>
...deleted...
>
>When I run my code, I get an error when pElements is being created.  

You mean when you try to compile your code (not run it).

>The error states: "error C2440: '=' : cannot convert from 'int ** ' to 'int *'"  I don't understand when I have and int**.  Can you tell me where I may be going wrong, please.  I read the previous emails, about the array of pointers, but don't seem to see why I am getting this error. Please help.

Look out for the previous email sent within the last 30 minutes
discussing this very same issue.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-699-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:41:57 2003
Return-Path: <uhcosc1320-return-699-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1fv5Z1444414
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:41:57 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1fvaG017635
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:41:57 -0500 (CDT)
Received: (qmail 13475 invoked by uid 108); 13 Aug 2003 01:47:46 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 21803 invoked from network); 13 Aug 2003 01:10:18 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130104.h7D14Nn01445066@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 20:04:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Assignment 4 submission (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 698
Content-Length: 733
X-Keywords: $NotJunk                                                                                           

>Could you please let me know if you got my assignment 4 with no problems because my computer at home is acting up and it keeps locking up on me when I'm sending my assignment so I'm not sure if it was sent  correctly.  Sorry for the inconvenience.  Thanks.

The only guaranteed way to check this is to look for the success message
to appear on the browser. If you did not get the success message,
then the submission did not happen.

Here is the exact message you should see on the browser after you click
the send button to submit your assignment:

"Submission successful"

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-700-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:44:34 2003
Return-Path: <uhcosc1320-return-700-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1iY5Z1454374
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:44:34 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1iXaG017747
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:44:33 -0500 (CDT)
Received: (qmail 15163 invoked by uid 108); 13 Aug 2003 01:50:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25640 invoked from network); 13 Aug 2003 01:16:31 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130110.h7D1AZ6s1446416@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 20:10:35 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] copy consturctor test (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 699
Content-Length: 1188
X-Keywords: $NotJunk                                                                                           

>how do you inherit from a template, how do you tell it what type is it char, 
>int, etc.

You may inherit a specific type like inheriting from Stack<int>
or you can write a template that inherits from the Stack template itself.

Venkat

>
>
>>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>>To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
>>Subject: [uhcosc1320] copy consturctor test (fwd)
>>Date: Tue, 12 Aug 2003 17:27:55 -0500 (CDT)
>>
>> >hello Venkat,
>> >
>> >        I have done most of my coding but I have no ideas to check my 
>>copy constructor. Could you please tell me how to test my copy consturctor 
>>in main? Thanks!
>> >
>>
>>That's easy. Simly write a class that inherits from your Stack class.
>>Then make a copy of the derived class object! This should invoke the
>>copy constructor of the base!
>>
>>Venkat
>
>_________________________________________________________________
>MSN 8 with e-mail virus protection service: 2 months FREE*  
>http://join.msn.com/?page=features/virus
>
>



Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-701-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:46:13 2003
Return-Path: <uhcosc1320-return-701-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1kD5Z1458326
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:46:13 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1kDuc001926
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:46:13 -0500 (CDT)
Received: (qmail 16271 invoked by uid 108); 13 Aug 2003 01:51:58 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 5111 invoked from network); 13 Aug 2003 01:35:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130129.h7D1Tf0Z1455257@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 20:29:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] for assign4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 700
Content-Length: 345
X-Keywords: $NotJunk                                                                                           

>Hi, Venkat
>I am very very sorry for my previous question about array of pointers. I have 
>just figured it out. Sorry for wasting your time again.
>
>Thank you very much.

No problem! 

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-702-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:46:20 2003
Return-Path: <uhcosc1320-return-702-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1kK5Z1439561
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:46:20 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1kJaG017826
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:46:20 -0500 (CDT)
Received: (qmail 16462 invoked by uid 108); 13 Aug 2003 01:52:04 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 1375 invoked from network); 13 Aug 2003 00:39:52 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130033.h7D0Xv001450097@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 19:33:57 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [uhcosc1320] HELP: assign4 error out of nowhere (fwd)
X-Spam-Status: No, hits=-0.1 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 701
Content-Length: 1970
X-Keywords: $NotJunk                                                                                           

>Can you explain what you mean by "The error you are getting is in line with what I would expect to see
>if the code is written the way it is written."  I tried and implemented a class test whose constructor took an integer, and I was able to push and pop the object of test in the stack. In my main, I have the class test and the ways its called in main, which is attached to this email incase you deleted the previous email.  thanks again.
>

I asked you to write a class which has a constructor that takes an int.
You are writing a class with a constructor that takes an int, but
the argument has a default value! 

Do you want to try this again, by removing the =100 from the constructor 
of your test class?

Venkat

>-------Original Message-------
>From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
>Sent: 08/12/03 05:26 PM
>To: COSC 1320 Mailing List <uhcosc1320@agiledeveloper.com>
>Subject: [uhcosc1320] HELP: assign4 error out of nowhere (fwd)
>
>> 
>> >I was playing with my stack class to see if I could have an array of
>pointers in my stack.  it gave me errors and I tried to undo it all, but now, I
>get errors i didn't get before.  I get errors in my constructor, but i'm
>not sure why. I didn't get any errors before, and I tried to rebuild all, but 
>that doesn't help. I seem to get an error when in my main i say "Stack <
>Stack<int> > stk;"  If i comment out the line, everything is okay, but when
>I don't have it commented out, I get an error.  Before I didnt' have any
>problems with this line of code.  Attached is the Stack.h and the exceptions  
>zipped up.  Please help.  Urgently needing your help.  Thanks again.
>
>
>The error you are getting is in line with what I would expect to see
>if the code is written the way it is written. You do not even have
>to try some thing as complicated as a Stack of Stack. Simply try
>to create a Stack of class X, where X has only one constructor which
>takes say an int as an argument.
>
>Venkat

From uhcosc1320-return-703-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:49:49 2003
Return-Path: <uhcosc1320-return-703-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1nn5Z1459255
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:49:49 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1nmuc002131
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:49:48 -0500 (CDT)
Received: (qmail 18807 invoked by uid 108); 13 Aug 2003 01:55:38 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 3822 invoked from network); 13 Aug 2003 01:33:28 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130127.h7D1RX5u1459158@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 20:27:33 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] getting an error while testing :( (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 702
Content-Length: 600
X-Keywords: $NotJunk                                                                                           

>/*
>I am getting error at this line
>cout<<stk.pop().pop()<<endl;
>
>where as this
>cout<<stk.pop().getsize()<<endl;
>works fine.
>
>getsize() is a function of Stack.h, just for debugging.
>
>
>if pop() is not working then getsize() shouldn't work either right.
>Can you please check it out. My brain is getting soupy. :)
>
>Thanks Venkat
>

When I tried to compile your code, I got a compilation error 
that pop is returning a const and you can't call the second
pop on the result. I remove the const from the return type of
pop and ran the code. It seems to produce the right results now.

Venkat

From uhcosc1320-return-704-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:51:12 2003
Return-Path: <uhcosc1320-return-704-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1pC5Z1447008
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:51:12 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1pBaG018025
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:51:12 -0500 (CDT)
Received: (qmail 19672 invoked by uid 108); 13 Aug 2003 01:57:01 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 24334 invoked from network); 13 Aug 2003 01:14:15 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130108.h7D18JtH1452877@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 20:08:19 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] for assign4 (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 703
Content-Length: 678
X-Keywords: $NotJunk                                                                                           

>Hello, Venkat
>I know I shouldn't ask you such a simple question. 

Is asking simple questions illegal in Texas? :)

>But since I have notbody 
>to ask for except expect your help.
>The question is when I try to create an array of pointers I have the 
>following code:
>
>...deleted...
>    pElements = new MEMBER[maxSize]; 
>//the above code cannot help me to create array of pointers but I tried other 
>ways 
>//they all didn't work so far, would you please give a hint 

How about

pElements = new MEMBER*[maxSize];

>the pElements is decleared as: MEMBER *pElement;

How about declaring it as 

MEMBER** pElement;

>Thank you very much for helping.

Most welcome.

Venkat

From uhcosc1320-return-705-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 20:57:16 2003
Return-Path: <uhcosc1320-return-705-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D1vG5Z1449424
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:57:16 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D1vGaG018242
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 20:57:16 -0500 (CDT)
Received: (qmail 23316 invoked by uid 108); 13 Aug 2003 02:03:05 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 30323 invoked from network); 13 Aug 2003 01:24:06 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130118.h7D1IAfR1412316@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 20:18:10 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] problems with throw!!!! (fwd)
X-Spam-Status: No, hits=1.7 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 704
Content-Length: 1402
X-Keywords: $NotJunk                                                                                           

>Hi Venlkat,
>I'm having some problem w. throwing the exceptions classes. The compiler giving me these errors:
> 
>.... error C2700: 'class StackExceptions::StackFull' : cannot be thrown (use -W4 for more info)  ....  while compiling class-template member function 'void __thiscall Stack<int>::push(const int &)'
>
>.....error C2700: 'class StackExceptions::StackEmpty' : cannot be thrown (use -W4 for more info) .....  while compiling class-template member function 'const int __thiscall Stack<int>::pop(void)'
>
>.....error C2700: 'class StackExceptions::StackFull' : cannot be thrown (use -W4 for more info) ..... while compiling class-template member function 'void __thiscall Stack<double>::push(const double &)'
>
>.....error C2700: 'class StackExceptions::StackEmpty' : cannot be thrown (use -W4 for more info) ......while compiling class-template member function 'const double __thiscall Stack<double>::pop(void)'
> 
>This is my push and pop:
>...deleted... 
>By the way, I'm following the law of big three and also the other stuff like: explicit constructors, protected copy constructors, private operator= in my StackEmpty and StackFull. 
>Thanks for your time.

Sorry, based on the amount of information and code you have given me,
I can't figure out the reason.

It says use -W4 for more information. I suspect it wants you to set the
warning level to 4. You may want to try that. 

Venkat

From uhcosc1320-return-706-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 21:43:25 2003
Return-Path: <uhcosc1320-return-706-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D2hP5Z1453090
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 21:43:25 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D2hPuc005107
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 21:43:25 -0500 (CDT)
Received: (qmail 17710 invoked by uid 108); 13 Aug 2003 02:49:14 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 15791 invoked from network); 13 Aug 2003 02:45:50 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130239.h7D2ds4t1441359@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 21:39:54 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Big three on exception classes? (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 705
Content-Length: 298
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>I do not think we need it, because we do not need any of the three:
>
>-copy constructor
>-destructor
>-operator=
>
>What is wrong with the defaults of the above in the Exception class.
>
>Thanks,
>

What is some one tries to extend (inherit that is) from your
StackFull class?

Venkat

From uhcosc1320-return-707-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 21:48:24 2003
Return-Path: <uhcosc1320-return-707-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D2mN5Z1460053
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 21:48:23 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D2mNaG020358
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 21:48:23 -0500 (CDT)
Received: (qmail 20488 invoked by uid 108); 13 Aug 2003 02:54:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 19007 invoked from network); 13 Aug 2003 02:51:25 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130245.h7D2jUZn1459800@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 21:45:30 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] parameter for push method by reference (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 706
Content-Length: 525
X-Keywords: $NotJunk                                                                                           

>you said in an earlier rule to pass an object by reference or const reference.  In my following code for the push method, can you please see that it is being done correctly.  PLEASE!!!
>
...deleted...

Light at the end of the tunnel finally! I think you are headling in 
the right direction now. Make sure you review the code to make sure
there are no logic errors.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-708-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 21:58:10 2003
Return-Path: <uhcosc1320-return-708-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D2wA5Z1455597
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 21:58:10 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D2w9aG020646
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 21:58:09 -0500 (CDT)
Received: (qmail 25739 invoked by uid 108); 13 Aug 2003 03:03:59 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 25038 invoked from network); 13 Aug 2003 03:02:36 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130256.h7D2uejr1290344@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 21:56:40 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: RE: [uhcosc1320] Big three on exception classes? (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 707
Content-Length: 1184
X-Keywords: $NotJunk                                                                                           

>Venkat,
>
>When I implement the BIG 3, I get the following errors:
>
>c:\cosc1320\assignments\assignment4\stack.h(92) : error C2700: 'class
>StackExceptions::StackFull' : cannot be thrown (use -W4 for more info)
>        c:\program files\microsoft visual
>studio\vc98\include\xmemory(59) : while compiling class-template member
>function 'void __thiscall Stack<long>::push(long)'
>c:\cosc1320\assignments\assignment4\stack.h(92) : error C2700: 'class
>StackExceptions::StackFull' : cannot be thrown (use -W4 for more info)
>        c:\program files\microsoft visual
>studio\vc98\include\xmemory(59) : while compiling class-template member
>function 'void __thiscall Stack<double>::push(double)'
>Error executing cl.exe.
>
>...deleted...
>It is the similar error another student had today with the -W4.
>
>Thanks,

Good to see this. It confirms what I had said in my previous email.

You have made the copy constructor of StackFull protected.
Exception classes must have public copy constructors. This is
because, some compilers always create a copy when you throw,
irrespective of how you catch. So, if you write a copy constructor
for an exception class, it must be public.

Venkat

From uhcosc1320-return-709-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 22:09:20 2003
Return-Path: <uhcosc1320-return-709-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D39K5Z1462797
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 22:09:20 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D39Juc006415
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 22:09:19 -0500 (CDT)
Received: (qmail 32072 invoked by uid 108); 13 Aug 2003 03:15:09 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 23753 invoked from network); 13 Aug 2003 03:00:01 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130254.h7D2s5T61460095@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 21:54:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] A little vector question (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 708
Content-Length: 1077
X-Keywords: $NotJunk                                                                                           

>Hi Venkat, 
>
>Though you did not teach us STL, you approved of its use in another
>email 2 hours ago and I have implemented it successfully (I think),
>except for one problem. 
>
>Vector<int> a;
>a.size() // this command returns a "type_t"
>
>I am not sure what a type_t is, but it "should" always be an int. it
>gives a warning when I return it, so I casted (big no-no) as an int to
>make the warning go away.
>
>return (int)m_vStack.size();
>
>...deleted...

According to the documentation I have, size returns a size_type.
size_type is an unsigned int. I think the warning tells you 
that you are returning an unsigned int when an int is expected.

On another note, I suggest that you do not modify too much code
just a few hours before the due time. It is too risky. If what
you have already done works fine, I suggest you keep that.
I have tried modifying code right before demos and it was not
too pleasant :).

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-710-cosc155g=bayou.uh.edu@agiledeveloper.com Tue Aug 12 22:12:38 2003
Return-Path: <uhcosc1320-return-710-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7D3Cc5Z1458475
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 22:12:38 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7D3Cbuc006604
	for <cosc155g@bayou.uh.edu>; Tue, 12 Aug 2003 22:12:37 -0500 (CDT)
Received: (qmail 1389 invoked by uid 108); 13 Aug 2003 03:18:22 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 16514 invoked from network); 13 Aug 2003 02:47:00 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308130241.h7D2f5Yj1448651@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Tue, 12 Aug 2003 21:41:05 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Should the exception class copy constructor be public? (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 709
Content-Length: 650
X-Keywords: $NotJunk                                                                                           

>Hi Venkat,
>
>Would you catch the exceptions by value or by reference in your main code?

Hummmm, I may try both.

>You had suggested that copy constructor should be protected but that would 
>be a problem if you are catching by value.

That is correct. For exception classes, the copy constructor is
actually not allowed to be protected!

>And you said that some compilers always catch by value, right? So it is 
>better to make it public in the exception class, isn't it?
>
>Thanks,

Yep.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-711-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug 13 08:02:03 2003
Return-Path: <uhcosc1320-return-711-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7DD235Z1489250
	for <cosc155g@bayou.uh.edu>; Wed, 13 Aug 2003 08:02:03 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7DD1vuc003091
	for <cosc155g@bayou.uh.edu>; Wed, 13 Aug 2003 08:02:02 -0500 (CDT)
Received: (qmail 3812 invoked by uid 108); 13 Aug 2003 13:07:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 31958 invoked from network); 13 Aug 2003 13:01:07 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308131255.h7DCt8MH1484155@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 13 Aug 2003 07:55:08 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] FIFO queue question (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 710
Content-Length: 2346
X-Keywords: $NotJunk                                                                                           

>Hi Dr.Venkat,
>I think I have solved the ambiguity of FIFO problem. I
>have made the modification as shown belwo in the code.
>
>...deleted...
>changes made:
>	FiFo(int theMaxSize)
>	{
>		maxSize = theMaxSize + 1; //change I made is to
>increase the size by 1
>		pElements = new int[maxSize];
>		topOfList = 0;
>		bottomOfList = 0;
>	}
>This is why I made the changes. When the FIFO is
>intially created it is empty . The bottom is equal to
>the top. As we add elements the bottom points to the
>next element in the queue that is added. Hence it
>moves to the next location. As we remove the elements
>from the queue the top pointer moves to the next
>location. During the movement of the "cursors"  we
>lose one place for the difference between the
>bottomofList and topOflist. Hence to regain that one
>position we need to add 1 to the maxsize. This is the
>only change that we need to perform for getting the
>FIFO working
>
>I hope this is correct.
>Thanks

Good try. There is actually a simpler solution. Kind of similar to
what you could have done for the Stack.

Just keep a count variable that tells you how many elements you have.
Then you do not need the bottomOfList. So, we use no more memory than
the solution that did not work, but it is fixed. Here is the code:

class FiFo
{
public:
	FiFo(int theMaxSize)
	{
		maxSize = theMaxSize;
		pElements = new int[maxSize];
		topOfList = 0;
		count = 0;
	}

	bool add(int a)
	{
		bool result = true; // not full.

		if (count == maxSize) 
			result = false;
		else
		{
			int position = (topOfList + count) % maxSize;

			pElements[position] = a;
			count++;
		}
		return result;
	}

	bool remove(int& value)
	{
		bool result = true; // not empty.
	
		if (count == 0)
			result = false;
		else
		{
			value = pElements[topOfList];
			topOfList = (topOfList + 1) % maxSize;
			count--;
		}

		return result;
	}

	int max() const { return maxSize; }

	int size() const 
	{
		return count;
	}

	~FiFo() { delete[] pElements; }

protected:
	FiFo(const FiFo& other)
	{
		maxSize = other.maxSize;
		topOfList = other.topOfList;
		count = other.count;

		pElements = new int[maxSize];

		for (int i = 0; i < maxSize; i++)
		{
			pElements[i] = other.pElements[i];
		}
	}

private:
	const FiFo& operator=(const FiFo& other);

private:
	int maxSize;
	int* pElements;
	int topOfList;
	int count;
};

From uhcosc1320-return-712-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug 13 19:44:54 2003
Return-Path: <uhcosc1320-return-712-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from bubble.cc.uh.edu (Bubble.CC.UH.EDU [129.7.235.172])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7E0is5Z1535005
	for <cosc155g@bayou.uh.edu>; Wed, 13 Aug 2003 19:44:54 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by bubble.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7E0irTU017506
	for <cosc155g@bayou.uh.edu>; Wed, 13 Aug 2003 19:44:53 -0500 (CDT)
Received: (qmail 15436 invoked by uid 108); 14 Aug 2003 00:50:47 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 9059 invoked from network); 14 Aug 2003 00:41:24 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308140035.h7E0ZNFH1524341@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 13 Aug 2003 19:35:23 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] The future and stuff... (fwd)
X-Spam-Status: No, hits=0 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 711
Content-Length: 2281
X-Keywords: $NotJunk                                                                                           

>In your final lecture on Thursday, you had quite a bit to say about the 
>future of C++ and more importantly, OOP and the programming industry in 
>general.  Basically, what I got out of it, is that .NET is the language of 
>the present and C++ is more or less outdated.  This is also the gist I get 
>from other people I know in the industry.  Everybody who says this seems to 
>be referring mainly to the applications of programming in the business and 
>software development world.  I was wondering, though, does the same thing go 
>for the world of scientific and mathematical programming?  I am a math/CS 
>double major and was thinking about going into computational mathematics and 
>computational modelling.  It seems like most of the Numerical Analysis 
>classes still use FORTRAN.  I'm not sure about the computer modelling 
>classes.  Is FORTRAN actually used in the industry aside from with legacy 
>code?  What languages are used often in computer modelling and simulation?  
>Is it important that I learn .NET and other modern OOP languages?  In 
>general, what would you suggest to a student interested in a career (and 
>probably grad school) in computer modeling and simulation and computational 
>mathematics?  I realize that you may not actually be in the specific field, 
>but I figured any advice could help.
>
>Thanks,

Fortran still plays an important role in simulation, though mostly
in maintaining legacy code. Most of the code written in the past
10+ years used some form of C and C++. Newer code is using other
languages including Java, C#, etc. I have worked with companies
writing simulators for engineering applications. In the days
that I worked or consulted with such organizations, they used
C++, CORBA and COM predominantly.

It is definitely worthwhile learning some of these more recent languages. 
I call it the incremental and interactive learning. Being a professional, 
you can never quit learning and you have to keep up with the technology and
trend. One of the goals of the class is to learn how to learn and
hope that has been realized in some form or fashion.

Wish you well.

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

From uhcosc1320-return-713-cosc155g=bayou.uh.edu@agiledeveloper.com Wed Aug 13 19:48:19 2003
Return-Path: <uhcosc1320-return-713-cosc155g=bayou.uh.edu@agiledeveloper.com>
Received: from squeak.cc.uh.edu (Squeak.CC.UH.EDU [129.7.235.175])
	by Bayou.UH.EDU (8.12.9/8.12.9) with ESMTP id h7E0mJ5Z1526825
	for <cosc155g@bayou.uh.edu>; Wed, 13 Aug 2003 19:48:19 -0500 (CDT)
Received: from mx251.mysite4now.com (haw-66-102-133-251.vel.net [66.102.133.251] (may be forged))
	by squeak.cc.uh.edu (8.12.9/8.12.9) with SMTP id h7E0mI9K022340
	for <cosc155g@bayou.uh.edu>; Wed, 13 Aug 2003 19:48:19 -0500 (CDT)
Received: (qmail 17830 invoked by uid 108); 14 Aug 2003 00:54:08 -0000
Mailing-List: contact uhcosc1320-help@agiledeveloper.com; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Post: <mailto:uhcosc1320@agiledeveloper.com>
List-Help: <mailto:uhcosc1320-help@agiledeveloper.com>
List-Unsubscribe: <mailto:uhcosc1320-unsubscribe@agiledeveloper.com>
List-Subscribe: <mailto:uhcosc1320-subscribe@agiledeveloper.com>
Delivered-To: mailing list uhcosc1320@agiledeveloper.com
Delivered-To: moderator for uhcosc1320@agiledeveloper.com
Received: (qmail 13954 invoked from network); 14 Aug 2003 00:48:41 -0000
From: "Dr. Venkat Subramaniam" <cosc155g@Bayou.UH.EDU>
Message-Id: <200308140042.h7E0gf1i1526642@bay.uh.edu>
To: uhcosc1320@agiledeveloper.com (COSC 1320 Mailing List)
Date: Wed, 13 Aug 2003 19:42:41 -0500 (CDT)
X-Mailer: ELM [version 2.5 PL6]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: [uhcosc1320] Signing off!!!!!!
X-Spam-Status: No, hits=1.7 required=5
X-Scanned-By: MIMEDefang 2.35
Status: O
X-UID: 712
Content-Length: 963
X-Keywords: $NotJunk                                                                                           

Greetings,

This is the last email you will receive from me though this mailing list.
(Hey, I heard you say thank goodness!).

I want to say my thanks to Jin and Meizhuo for their assistance during 
the semester. Special thanks to Jin for his extra assistance and
quick response to my questions. 

I hope you enjoyed the course as much as I did. It surely would not
have been the pleasure if not for those of you who pushed me a bit
harder and asked such wonderful questions, and displayed your
genuine interest in learning. It is you who make this worth my while
and exciting for me. 

It isn't easy, but give it your best shot. Hope our paths will
cross again in the future. What ever you do, do it well and have 
as much fun as the law allows.

Wish you all the best.

This mailing list is now closed!

Venkat Subramaniam
--				
cosc155g@bayou.uh.edu		Department of Computer Science
http://www.cs.uh.edu/~svenkat 	University of Houston, Houston, Tx 77204-3475

