question about arrays and structs

Can arrays and structs be used in the declarations of class attributes? if so are they combined or redifined? i was told in C++ you no longer need to use typedef name for a structure or use the struct keyword. any help on this would be appreciated! thanks in advance
Who is Participating?
ntdragonConnect With a Mentor Commented:
what i'm saying is you can and may use them together but if you use classes you don't need structs

<or i really didn't understood your question>
<< Can arrays and structs be used in the declarations of class attributes? >>

Yes they can.  Say you have a structure:

struct struct1
   char abc[10];
   int def;
   long ghi;

Now in a class declaration below:

class class1
   char string1[20];
   struct1 aStructvar;

Here we have a class called class1 that consists of a character array and another struct.  You reference the above array as follows:

class1 classVar;[0] = '\0';
classVar.struct1.def = 150;
classVar.struct1.ghi = 233124;
class1.string1[0] = '\0';

in c++ you don't use structs you use class

it's alot better with some intersting and usefull opetions

but ofcourse you can use arrays and structs in class's you even can make class's in other class's

do you want to how anything else
beachbummAuthor Commented:
so what you are saying is that arrays and structs are combined or are they redefined in the declarations of class attributes?
beachbummAuthor Commented:
see above comment...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.