
How are classes related to objects in .NET Application?As per object
oriented programming, properties and the methods that access these properties
are binded together into an entity. This is known as encapsulation. In this example,
you have a class called sampleClass containing a property called dataMember1.
Two methods namely setData and getData are trying to access this property.
Hence both the methods are wrapped inside sampleClass. Till this it looks
fine. But how do you access a class and its members? For that you have
to create an instance of the class and that instance is termed as object
of the class. Given below is a sample code to show how to create object
for the class sampleClass: In this example,
you create an object obj of sampleClass and access setData and getData
methods using this object. This is how
classes and objects are related. Object is the instance of the class with
which you can access the class members.
_______________________________________________________________________
FREE
Subscription
Subscribe
to our mailing list and receive new articles Note
: We never rent, trade, or sell my email lists to Visit
.NET Programming Tutorial Homepage ______________________________________________________ |