| www.delorie.com/djgpp/mail-archives/browse.cgi | search |
| From: | "Lark" <rlark DOT at DOT mbhs DOT dot DOT edu AT delorie DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Pointer dec call the constructor? |
| Date: | Fri, 23 Apr 1999 21:41:23 -0700 |
| Organization: | MindSpring Enterprises |
| Lines: | 31 |
| Message-ID: | <7fr7hv$ouc$1@nntp1.atl.mindspring.net> |
| NNTP-Posting-Host: | d1.8a.28.f8 |
| X-Server-Date: | 24 Apr 1999 01:42:23 GMT |
| X-Newsreader: | Microsoft Outlook Express 4.72.3110.1 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Does a pointer declaration call the constructor of the type of object it
points to? For example:
class A
{
public:
A(){x=5}
int x;
};
A * ob;
is A::A() called on ob? And if not, if I had a second class,
class B:public A
{
public:
B(){y=7}
int y;
};
and then write this:
A * ob;
ob = new B();
is A::A() called first or is B::B() called first? Sorry if this isn't
terribly clear, and thanks for any help!
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |