Scope vs Visiblity vs Lifetime vs Accessibility vs etc

I have been trying to understand what it means to say “scope of a named entity”. In reading about scope, there are terms like visibility, lifetime, accessibility and more that are used. What is confusing is the fact that the terms are at
times used distinctly and at times interchangeably.

Quoting from this IBM article:

scope is… the largest region in which the name potentially is valid.

Fair enough. But then what does this mean –

The visibility of an identifier is the region of program text from which the object associated with the identifier can be legally accessed.

Is visibility related to accessibility?

Further it goes on to say

Scope exceeds visibility when a duplicate identifier is used in an inner declarative region, thereby hiding the object declared in the outer declarative region. The original identifier cannot be used to access the first object until the scope of the duplicate identifier (the lifetime of the second object) has ended.

Does this mean scope and lifetime are the same things?

Do these terms like scope fundamentally mean the same thing in C++ as it does in say PHP or Python or even Java. Or they could mean different things conceptually depending on the language you are working in. The article I have quoted is C/C++ related, but I want to understand the terms in the general sense.

1

Scope, visibility and accessibility are all really talking about the same thing; given a particular declaration when can that declaration be referenced. Scope is the most general term and encompasses both visibility and accessibility and the referenced quote is adequate. Visibility and accessibility are usually applied to the members of a class as it is easier to think of them as being “hidden” or “not visible” as opposed to out of scope; that is, myMember is either private, protected or public controlling the visibility of the member in a class and its decedents. When inside a method of a class, all members are accessible or visible but only public members are from outside the class. protected members are only accessible or visible from the class itself or one of its derived classes. All of these contribute to the scope of myMember, that is the smallest region of text that can access myMember.

The parenthetical about lifetime is technically accurate for local variables but is really mixing a runtime concept, lifetime, with a compile-time or lexical concept, scope. You should ignore it. It is more confusing than helpful when trying to understand scope. Understanding lifetime is important to understand when a destructor is run and is related to scope but not important in understanding scope.

I believe those terms are the same for all the languages, since it’s how the Compiler (or Interpreter) will save internally the variables, and access them.

[Edit] The C example is better for this purpose.

#include <stdio.h>

int i = 4;

void myMethod(void) {
  int j = 3;
  printf("I can see var i from the outside: %dn", i);
}

void anotherMethod(void) {
  int i = 2;
  printf("Scope of 'i' declared outside of the method is valid, but it's not visible.n");
  printf("You'll see the 'i' variable declared inside the method: %dn", i);
}

int main(void) {
  myMethod();
  printf("Asking for j will give an error, because it's outside the scopen");
  anotherMethod();
}

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Scope vs Visiblity vs Lifetime vs Accessibility vs etc

I have been trying to understand what it means to say “scope of a named entity”. In reading about scope, there are terms like visibility, lifetime, accessibility and more that are used. What is confusing is the fact that the terms are at
times used distinctly and at times interchangeably.

Quoting from this IBM article:

scope is… the largest region in which the name potentially is valid.

Fair enough. But then what does this mean –

The visibility of an identifier is the region of program text from which the object associated with the identifier can be legally accessed.

Is visibility related to accessibility?

Further it goes on to say

Scope exceeds visibility when a duplicate identifier is used in an inner declarative region, thereby hiding the object declared in the outer declarative region. The original identifier cannot be used to access the first object until the scope of the duplicate identifier (the lifetime of the second object) has ended.

Does this mean scope and lifetime are the same things?

Do these terms like scope fundamentally mean the same thing in C++ as it does in say PHP or Python or even Java. Or they could mean different things conceptually depending on the language you are working in. The article I have quoted is C/C++ related, but I want to understand the terms in the general sense.

1

Scope, visibility and accessibility are all really talking about the same thing; given a particular declaration when can that declaration be referenced. Scope is the most general term and encompasses both visibility and accessibility and the referenced quote is adequate. Visibility and accessibility are usually applied to the members of a class as it is easier to think of them as being “hidden” or “not visible” as opposed to out of scope; that is, myMember is either private, protected or public controlling the visibility of the member in a class and its decedents. When inside a method of a class, all members are accessible or visible but only public members are from outside the class. protected members are only accessible or visible from the class itself or one of its derived classes. All of these contribute to the scope of myMember, that is the smallest region of text that can access myMember.

The parenthetical about lifetime is technically accurate for local variables but is really mixing a runtime concept, lifetime, with a compile-time or lexical concept, scope. You should ignore it. It is more confusing than helpful when trying to understand scope. Understanding lifetime is important to understand when a destructor is run and is related to scope but not important in understanding scope.

I believe those terms are the same for all the languages, since it’s how the Compiler (or Interpreter) will save internally the variables, and access them.

[Edit] The C example is better for this purpose.

#include <stdio.h>

int i = 4;

void myMethod(void) {
  int j = 3;
  printf("I can see var i from the outside: %dn", i);
}

void anotherMethod(void) {
  int i = 2;
  printf("Scope of 'i' declared outside of the method is valid, but it's not visible.n");
  printf("You'll see the 'i' variable declared inside the method: %dn", i);
}

int main(void) {
  myMethod();
  printf("Asking for j will give an error, because it's outside the scopen");
  anotherMethod();
}

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Scope vs Visiblity vs Lifetime vs Accessibility vs etc

I have been trying to understand what it means to say “scope of a named entity”. In reading about scope, there are terms like visibility, lifetime, accessibility and more that are used. What is confusing is the fact that the terms are at
times used distinctly and at times interchangeably.

Quoting from this IBM article:

scope is… the largest region in which the name potentially is valid.

Fair enough. But then what does this mean –

The visibility of an identifier is the region of program text from which the object associated with the identifier can be legally accessed.

Is visibility related to accessibility?

Further it goes on to say

Scope exceeds visibility when a duplicate identifier is used in an inner declarative region, thereby hiding the object declared in the outer declarative region. The original identifier cannot be used to access the first object until the scope of the duplicate identifier (the lifetime of the second object) has ended.

Does this mean scope and lifetime are the same things?

Do these terms like scope fundamentally mean the same thing in C++ as it does in say PHP or Python or even Java. Or they could mean different things conceptually depending on the language you are working in. The article I have quoted is C/C++ related, but I want to understand the terms in the general sense.

1

Scope, visibility and accessibility are all really talking about the same thing; given a particular declaration when can that declaration be referenced. Scope is the most general term and encompasses both visibility and accessibility and the referenced quote is adequate. Visibility and accessibility are usually applied to the members of a class as it is easier to think of them as being “hidden” or “not visible” as opposed to out of scope; that is, myMember is either private, protected or public controlling the visibility of the member in a class and its decedents. When inside a method of a class, all members are accessible or visible but only public members are from outside the class. protected members are only accessible or visible from the class itself or one of its derived classes. All of these contribute to the scope of myMember, that is the smallest region of text that can access myMember.

The parenthetical about lifetime is technically accurate for local variables but is really mixing a runtime concept, lifetime, with a compile-time or lexical concept, scope. You should ignore it. It is more confusing than helpful when trying to understand scope. Understanding lifetime is important to understand when a destructor is run and is related to scope but not important in understanding scope.

I believe those terms are the same for all the languages, since it’s how the Compiler (or Interpreter) will save internally the variables, and access them.

[Edit] The C example is better for this purpose.

#include <stdio.h>

int i = 4;

void myMethod(void) {
  int j = 3;
  printf("I can see var i from the outside: %dn", i);
}

void anotherMethod(void) {
  int i = 2;
  printf("Scope of 'i' declared outside of the method is valid, but it's not visible.n");
  printf("You'll see the 'i' variable declared inside the method: %dn", i);
}

int main(void) {
  myMethod();
  printf("Asking for j will give an error, because it's outside the scopen");
  anotherMethod();
}

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa

Scope vs Visiblity vs Lifetime vs Accessibility vs etc

I have been trying to understand what it means to say “scope of a named entity”. In reading about scope, there are terms like visibility, lifetime, accessibility and more that are used. What is confusing is the fact that the terms are at
times used distinctly and at times interchangeably.

Quoting from this IBM article:

scope is… the largest region in which the name potentially is valid.

Fair enough. But then what does this mean –

The visibility of an identifier is the region of program text from which the object associated with the identifier can be legally accessed.

Is visibility related to accessibility?

Further it goes on to say

Scope exceeds visibility when a duplicate identifier is used in an inner declarative region, thereby hiding the object declared in the outer declarative region. The original identifier cannot be used to access the first object until the scope of the duplicate identifier (the lifetime of the second object) has ended.

Does this mean scope and lifetime are the same things?

Do these terms like scope fundamentally mean the same thing in C++ as it does in say PHP or Python or even Java. Or they could mean different things conceptually depending on the language you are working in. The article I have quoted is C/C++ related, but I want to understand the terms in the general sense.

1

Scope, visibility and accessibility are all really talking about the same thing; given a particular declaration when can that declaration be referenced. Scope is the most general term and encompasses both visibility and accessibility and the referenced quote is adequate. Visibility and accessibility are usually applied to the members of a class as it is easier to think of them as being “hidden” or “not visible” as opposed to out of scope; that is, myMember is either private, protected or public controlling the visibility of the member in a class and its decedents. When inside a method of a class, all members are accessible or visible but only public members are from outside the class. protected members are only accessible or visible from the class itself or one of its derived classes. All of these contribute to the scope of myMember, that is the smallest region of text that can access myMember.

The parenthetical about lifetime is technically accurate for local variables but is really mixing a runtime concept, lifetime, with a compile-time or lexical concept, scope. You should ignore it. It is more confusing than helpful when trying to understand scope. Understanding lifetime is important to understand when a destructor is run and is related to scope but not important in understanding scope.

I believe those terms are the same for all the languages, since it’s how the Compiler (or Interpreter) will save internally the variables, and access them.

[Edit] The C example is better for this purpose.

#include <stdio.h>

int i = 4;

void myMethod(void) {
  int j = 3;
  printf("I can see var i from the outside: %dn", i);
}

void anotherMethod(void) {
  int i = 2;
  printf("Scope of 'i' declared outside of the method is valid, but it's not visible.n");
  printf("You'll see the 'i' variable declared inside the method: %dn", i);
}

int main(void) {
  myMethod();
  printf("Asking for j will give an error, because it's outside the scopen");
  anotherMethod();
}

4

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật