August 16, 2001 Classes and Structs | ||||
|---|---|---|---|---|
| ||||
What is the difference between a class and a struct, can structs have member
methods?
If they do is the difference that they are not virtual? Are structs
reference counted?
Whats the true size of a struct,
E.g. if we have
struct test
{
int a, b;
void func() {};
}
whats the sizeof test 8 bytes or 16 bytes?
| ||||
August 16, 2001 Re: Classes and Structs | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nathan Matthews | Im Artikel <9lgpjv$2bnb$1@digitaldaemon.com> schrieb "Nathan Matthews" <nedthefed@nospam.hotmail.com>: > What is the difference between a class and a struct, can structs have member methods? Read the doc... Structs, Unions They work like they do in C, with the following exceptions: ... * Member functions and static members are not allowed. Structs and unions are meant as simple aggregations of data, or as a way to paint a data structure over hardware or an external type. ... Object oriented features are provided with the class data type. -- Sheldon Simms / sheldon@semanticedge.com | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply