Multiple inheritance in vb.net


This slideshow requires JavaScript.

Hey,

VB.net doesn’t support multiple inheritance by default,

but we can implement  multiple inheritance using inheritance. here is example of student entry. click here to see code

You can download vb.net code files for visual studio from below.

we can add multiple inheritance using interface keyword for example

 Public Interface name

Function execute() As name1

End Interface

here interface name is can be used in class to execute function whose return type is name1 structure note that, this return type depends on function. You can not interface a function of type integer or double with this interface.

Public Function name() As name1

Implements name.execute nam.fn = InputBox(“enter Student’s first name”)

nam.ln = InputBox(“enter Student’s last name”)

Return nam End Function

this function implements name interface’s function execute. nam is member of structure name1

Public Structure name1 Public fn, ln As String End Structure

in main program i’m returning this structure to another structure defined in that class and using it to print data

Download visual studio files

Advertisements

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s