473,395 Members | 1,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Polymorphism in VB

164 100+
Hi all

Somebody please give me a small code for polymorphism concept in vb6.0

Can we do polymorphism in VB?

We have to achieve polymorphism without using any cls or bas modules

THanx
Jul 26 '07 #1
4 1551
pureenhanoi
175 100+
Hi all

Somebody please give me a small code for polymorphism concept in vb6.0

Can we do polymorphism in VB?

We have to achieve polymorphism without using any cls or bas modules

THanx
If you don't want using CLS module, so it's not OOP. But it's available to store information without using Class. You will be using Structure. Let see
Expand|Select|Wrap|Line Numbers
  1. Type structName
  2.           memberVarrialbe1 As Long
  3.           memberVarriable2 As String
  4. End Type
  5. Dim V1 As structName
  6. 'now, store info into struc
  7. Private Sub Form_Load()
  8.      V1.memberVarriable1 = 100
  9.      V1.memberVarriable2 = "abcdef...."
  10. End Sub
  11.  
Jul 26 '07 #2
arunbalait
164 100+
If you don't want using CLS module, so it's not OOP. But it's available to store information without using Class. You will be using Structure. Let see
Expand|Select|Wrap|Line Numbers
  1. Type structName
  2.           memberVarrialbe1 As Long
  3.           memberVarriable2 As String
  4. End Type
  5. Dim V1 As structName
  6. 'now, store info into struc
  7. Private Sub Form_Load()
  8.      V1.memberVarriable1 = 100
  9.      V1.memberVarriable2 = "abcdef...."
  10. End Sub
  11.  
ya fine

But am getting error for defining the Type.

Couldnot define a public-user defined type within a private object module.

How to define the type here?

Thanx
Jul 30 '07 #3
pureenhanoi
175 100+
ya fine

But am getting error for defining the Type.

Couldnot define a public-user defined type within a private object module.

How to define the type here?

Thanx
If you define a structure within a Form, add "Private" keyword before "Type"
Private Type ASTRUCTURE_TYPE
...
End Type
If you want it to be public, define structure within a Module.
Jul 31 '07 #4
arunbalait
164 100+
If you define a structure within a Form, add "Private" keyword before "Type"
Private Type ASTRUCTURE_TYPE
...
End Type
If you want it to be public, define structure within a Module.
Ya thanx

I got it now...

Thanx for your idea. So in VB only OOP is obtained by using modules. RIght?
Aug 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

37
by: Mike Meng | last post by:
hi all, I'm a newbie Python programmer with a C++ brain inside. I have a lightweight framework in which I design a base class and expect user to extend. In other part of the framework, I heavily...
18
by: Ken | last post by:
Hi. Can anyone refer me to any articles about the compatibility between c++ polymorphism and real-time programming? I'm currently on a real-time c++ project, and we're having a discussion...
3
by: E. Robert Tisdale | last post by:
polymorph just means "many form(s)". The definition in plain English http://www.bartleby.com/61/66/P0426600.html and narrower definitions in the context of computer programming ...
11
by: richard pickworth | last post by:
Can anyone explain polymorphism?(very simply). thanks richard
4
by: LP | last post by:
Hi, I understand the concept/definition of polymorphism. But what does the term "runtime polymorphism" mean? I was asked to define it during a technical interview. I gave a guy vanilla definition...
13
by: Krivenok Dmitry | last post by:
Hello all! Perhaps the most important feature of dynamic polymorphism is ability to handle heterogeneous collections of objects. ("C++ Templates: The Complete Guide" by David Vandevoorde and...
18
by: Seigfried | last post by:
I have to write a paper about object oriented programming and I'm doing some reading to make sure I understand it. In a book I'm reading, however, polymorphism is defined as: "the ability of two...
2
by: sarathy | last post by:
Hi all, I need a small clarification reg. Templates and Polymorphism. I believe templates is really a good feature, which can be used to implement generic functions and classes. But i doubt...
11
by: chsalvia | last post by:
I've been programming in C++ for a little over 2 years, and I still find myself wondering when I should use polymorphism. Some people claim that polymorphism is such an integral part of C++,...
17
by: Bart Friederichs | last post by:
Hello, I created the following inheritance: class Parent { public: void foo(int i); }; class Child : public Parent {
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.