C# .NET - Which OOPS concept is used
Asked By anbu n on 28-Dec-11 07:30 PM
SmtpClient smtp_Client = new SmtpClient ();
smtp_Client.Credentials = new NetworkCredential("a", "b");
here in above in 2nd line ,
smtp_Client is the object of class SmtpClient but its assigned with class NetworkCredential
what OOPS concept is used,
can somebody explain
[)ia6l0 iii replied to anbu n on 28-Dec-11 09:45 PM
The smtp_client is not assigned with Network Credential. The Credentials property of the smtp_client object is assigned to the NetworkCredential.
SmtpClient.Credentials Property needs a value of type System.Net.ICredentialsByHost. You can pass any class objects that implements this interface. NetworkCredential class happens to be one such class.
NetworkCredential has done something that can be termed as "Interface inheritance" or "Interface implementation".
Web Star replied to anbu n on 28-Dec-11 10:38 PM
Basically in OOPS, everything represent as an object and a class object may hold the another object .
So here the Credentials property of SmtpClient class hold the object of NetworkCredential class simply.
anbu n replied to [)ia6l0 iii on 30-Dec-11 12:27 AM
thanks for your reply ,
if you are free... can u please send some example code related to that