How would you define the scope of Public, Private, Friend procedures?
Hi,
How would you define the scope of Public, Private, Friend procedures?
Re: How would you define the scope of Public, Private, Friend procedures?
Public procedure is available anywhere it is global
private procedure is accessible only within the class where it is declared
friend procedure is available outside the class but not outside the project in which it is declared
Re: How would you define the scope of Public, Private, Friend procedures?
The set of public variables, methods, properties, and events described in a class module define the interface for an object. The interface consists of the object members that are available to a programmer who's using the object
from code.
You can create private variables, methods, properties, and events that are used by other procedures within the class module but are not part of the object's public interface. Additionally, constants user-defined types, and Declare statements within a class module must always be private.
The Friend keyword makes a procedure private to the project: The procedure is available to any code running within the project, but it is not available to a referencing project.
Re: How would you define the scope of Public, Private, Friend procedures?
When we declare private procedure that procedure can be access with in the current module.It can't be access out side the module.private key word use for data hiding purpose.In case of Friend key word,we can access the procedure through out the current project.Public is fully different from Private & Friend.It can be access out side the project & Current Project.Out Side project means,if we declare create dll,the type library of dll will contain that public procedure as a method of dll but not private & Friend.