#include <iostream>
#include <string>
using namespace std;
class Box {
// attributes
public:
int size = 1;
string type;
Box(int size, string type) {
}
};
int main() {
Box e(2, "b");
string b = e.type;
cout << b;
}
I have a little question with this code, these two variables named type
in the constructor are the same right? (the type
outside of the constructor and the type
inside the constructor) but just in different scopes right? like any two variables with the same name and datatype are the same but their values canbe different in different scopes correct?