| delorie.com/archives/browse.cgi | search |
| Sender: | pgg AT hq DOT obop DOT com DOT pl |
| Message-ID: | <353C4927.123E9735@usa.net> |
| Date: | Tue, 21 Apr 1998 09:22:15 +0200 |
| From: | "Przemyslaw G. Gawronski" <gawronskip AT usa DOT net> |
| Reply-To: | gawronskip AT usa DOT net |
| Organization: | take it easy |
| MIME-Version: | 1.0 |
| To: | loren <loren AT seric DOT es> |
| CC: | djgpp AT delorie DOT com |
| Subject: | Re: OOP with DJGPP |
| References: | <353B38BC DOT 6C688A2D AT seric DOT es> |
loren wrote:
> I'm trying to declare some OOP classes in DJGPP but ...
> it doesn't works!!!!! =8-/
> Does DJGPP support Object-Oriented Programming?
> Why this:
>
> class MyClass {
> int my_var;
> MyClass();
> ~MyClass();
> }
>
> Doesn't works?
Yes it does !!!
By default all members after the '{' of a class are private. Class user
doesn't have access to them. So it would be inposible to make an
instance of such a class since the constructor is private. To make it
work You have to make the constructor public. This should work fine:
class MyClass
{
int my_var;
public:
MyClass();
~MyClass();
}
Good luck
Przemek
--
/----------------------------------------------------\
| Przemyslaw G. Gawronski mailto:gawronskip AT usa DOT net |
| ICQ:8358522 |
\----------------------------------------------------/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |