In the example below, the abstract class Name implements the IName interface; its inheritance relationship to all other name objects indicates that they each implement the IName interface as well. Although neither the FeatureClassName nor WorkspaceName coclass shows the IName interface in the diagrams, you know it is there because of this inheritance. The Open() method on the IName interface is used to instantiate the FeatureClass object. This usage guarantees that the new FeatureClass object is properly created and includes all necessary information.
The Name abstract class, WorkspaceName and Tablename coclasses, and FeatureClass objects and their relationships
The case below illustrates its importance clearly: opening a shapefile dataset to extract a feature class is not as simple as just reading the database records.
[VBA]
Dim pwrkspc As IWorkspaceName
Set pwrkspc = New WorkspaceName
pwrkspc.PathName = "D:\data\canada"
pwrkspc.WorkspaceFactoryProgID = _ "esriDataSourcesFile.shapefileworkspacefactory.1"
'***************************************************
Dim pdatasetname As IDatasetName
Set pdatasetname = New FeatureClassName
pdatasetname.Name = "Canada.dbf"
Set pdatasetname.WorkspaceName = pwrkspc
Dim pname As IName
Set pname = pdatasetname
Dim pfeatclass As IFeatureClass
Set pfeatclass = pname.Open
''Check FeatureType property to ensure you have a featureclass object
MsgBox pfeatclass.FeatureType
An association is shown in the code above where the WorkspaceName object was set to the WorkspaceName property of the FeatureClassName object. As noted earlier, for simplicity's sake, many of the associations in ArcObjects aren't drawn on the diagrams. In fact, this association between the WorkspaceName and FeatureClassName classes isn't shown on the GeoDatabase library object model diagram; however, it can be seen in the IName interface detail for the WorkspaceName property since the symbol used is a Property Put by Reference. Since the WorkspaceName class is being held as a reference and not in a composition relationship, the object's lifespan will not be controlled by the FeatureClassName object. If you were to use the code below to set the FeatureClassName object to nothing, the WorkspaceName class would still exist.
[VBA]
Set pfeatclass = Nothing
If Not pwrkspc Is Nothing Then
MsgBox "Object still exists"
End If