Variables declaration scope

0 hussam el-dien el-emmawi · June 2, 2015
In the Class .. it is ok to declare the variable name after using it in setName , getName func ?? 

Post a Reply

Replies

Oldest  Newest  Rating
0 Zachary B · June 3, 2015
You can arrange public/private how you want..

this would work 

class Example
{
     public:
          setName(std::string n) { n = name;}
          getName() {return name;}

     private:
  • 1

C++

107,075 followers
About

Used in many types of software including music players, video games, and many large scale applications.

Links
Moderators
Bucky Roberts Administrator