What is myClass myObj ? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

What is myClass myObj ?

#include <iostream> #include <string> using namespace std; class myClass { public: string name; }; int main() { myClass myObj; myObj.name = "SoloLearn"; cout << myObj.name;

26th Jun 2018, 4:57 PM
Aashutosh Swami
Aashutosh Swami - avatar
2 Respostas
+ 1
myClass is a blueprint for constructing a object of type "myClass". myObj is a structure, that has all attributes (name here) and methods (none methods here) defined in myClass scope. myClass myObject command is declaring an object using myClass blueprint. ItĀ“s similar to declariong primitive data types, such as "int h". myClass and int are both data types and myObj and h are names for the variable/object.
26th Jun 2018, 5:32 PM
Jan Štěch
Jan Štěch - avatar
0
Thanks
4th Jul 2018, 12:19 PM
Aashutosh Swami
Aashutosh Swami - avatar