|
-
Mar 2nd, 2002, 10:05 AM
#1
Thread Starter
Member
Defining array elements as different types?
Is it possible to define an array`s different layers as different types, classes?
I`m not sure but I think it may be done by templates, but how?
Would you please make me know how to do this or if there is any other existing way.
Thanks in advance.
Last edited by might; Mar 3rd, 2002 at 05:15 AM.
-
Mar 2nd, 2002, 01:54 PM
#2
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 2nd, 2002, 03:40 PM
#3
transcendental analytic
vector is an existing way, if you mean layers as in generic programming, check out the STL at sgi.com
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 3rd, 2002, 05:11 AM
#4
Thread Starter
Member
-
Mar 3rd, 2002, 06:46 AM
#5
transcendental analytic
It is called polymorphism, take a look at this tutorial
http://newdata.box.sk/bx/c/
Btw, you should also read the chapters before just to make sure you understand some other important concepts.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 3rd, 2002, 08:31 AM
#6
Thread Starter
Member
Thanks a lot for your replies and interest , Kedaman, and also CornedBee for his interest.
I know polymorphism, because I started learning C++ with the online version of Teach Yourself C++ in 21 Days. 
I have had the idea to use inheritance also. But to do this I have to create an empty base class that inherits CLine, CArc etc.
But here has been a problem: I have been using Visual Studio .NET Beta 1 and mostly it doesn`t let me access to the members of an object (it usually forgets the mission of the " . " for objects and "->" for pointers to classes. )It`s just a weird. So it has always made me mistaken. I thought that I was doing something wrong, even I did right.
Anyway, I will try polymorphism.
Thank you very much, again.
Last edited by might; Mar 3rd, 2002 at 08:36 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|