TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: Neil Heller
from: Darin McBride
date: 2003-01-18 19:55:30
subject: Declaring a pointer to a

Hello Neil!

Replying to a message of Neil Heller to Darin McBride:

 DM>> MSVC 5 should be okay by now, I'd think.  Maybe if you were using
 DM>> version 1.3  or something I could see some issues, but even that ...
 DM>> I  was doing this stuff on MSVC 1.41 without issues.  At  least, not
 DM>> these issues :-)

 NH> You talked about only 16-bit compilers.  Is anybody still doing 16-bit 
 NH> development (other than some specialized, embedded systems)?

I do believe that my electronic tax package from last year had a 16-bit
Win3.1 version.  Of course, those are changed yearly, so I assume that
there is still some 16-bit development going on :-)

 NH>> ClassB::ClassB( ClassAptr aaa )
 NH>> {
 NH>>    abc = aaa;
 NH>> }

 DM>> Again, nothing fundamentally wrong, but try:

 DM>> ClassB::ClassB( ClassAptr aaa ) :
 DM>>     abc(aaa)
 DM>> {
 DM>> }

 NH> I'm completely unfamiliar with this notation when used in a
 NH> constructor.   Does this mean that the programmer will ultimately be
 NH> responsible for  making a constructor specifically for this
 NH> situation?

For non-built-ins?  Nothing is preventing you from using the automatic copy
constructor, or any other constructor.  For example:

class Ray3D
{
private:
  Ray2D ray2d;
  int z;
public:
  Ray3D(int x, int y, int z) :
      ray2d(x,y), z(z)
  {}
};

This assumes that the Ray2D class takes two ints as its constructor.  This
is somewhat faster than:

Ray3D(int x, int y, int z_)
{
  ray2d.setx(x);
  ray2d.sety(y);
  z = z_;
}

In this case, ray2d is constructed with the default constructor, and then
you call the setx() and sety() methods on it.

Regardless - either there is a constructor that you are going to call, or
you have to add an appropriate one.  But it does not have to be a
constructor that is only made for this purpose - you can use ones that were
made for other reasons.

 DM>> I don't see any fundamental differences between this (which 
 DM>> compiles) and the original (which doesn't).  I would then 
 DM>> have to make the awesome leap of logic that the problem is 
 DM>> rooted elsewhere ;->

 NH> Awesome? :->

Aren't you full of awe at my incredible ability to come to such conclusions?  :-)

Darin
C_PLUSPLUS moderator
dmcbride{at}tower.to.org

---
* Origin: Tanktalus' Tower BBS (1:250/102)
SEEN-BY: 633/267 270
@PATH: 250/102 99 10/345 379/1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.