lundi 5 août 2019

How to initialize Structure in a class constructor

I have this constructor which is a member of a class with the name of Material.

struct RGBColor
{
float r;
float g;
float g;
};

In the class constructor i can initialze the constructor to the value of 1

Material.r = 1.0;
Material.g = 1.0;
Material.b = 1.0

Since i have to initialize all of the members to the same value can i Initialize The material itself to the value of 1 rather than writing three lines .

Aucun commentaire:

Enregistrer un commentaire