[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: struct vs. class in regexp.h
From: |
Rik |
Subject: |
Re: struct vs. class in regexp.h |
Date: |
Fri, 02 Mar 2012 09:13:51 -0800 |
On 03/02/2012 04:42 AM, address@hidden wrote:
> Message: 3
> Date: Fri, 2 Mar 2012 09:01:02 +0000
> From: Michael Goffioul <address@hidden>
> To: Octave Maintainers List <address@hidden>
> Subject: regexp::opts declared as struct and class
> Message-ID:
> <address@hidden>
> Content-Type: text/plain; charset=ISO-8859-1
>
> In file liboctave/regexp.h, regexp::opts is forward-declared as
> "class", then defined later as "struct". Both uses should be
> consistent, but which one should it be? class or struct?
I would vote for class. Class or struct are functionally very equivalent,
with the caveat that structs default everything to public access and
classes default everything to private access. From a philosophical
perspective, however, I use classes when I'm thinking object-oriented
programming, data encapsulation, etc. I use structs if I'm thinking of
just some bits of information housed together in a convenient package.
In this case, if I look look at the code for the opts class/struct we have
some private data and there are public getter/setter routines. This looks
like a class implementing data encapsulation which is why I vote for class.
--Rik
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: struct vs. class in regexp.h,
Rik <=