It is currently Thu Nov 26, 2020 3:52 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Multiextending
PostPosted: Sat May 31, 2008 7:14 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 12, 2005 3:35 am
Posts: 803
Location: Germany(Hessen)
Hi,

I've a little wish again.
It would be very cool, if you could make it possible, that we can use more than one extends with structures.

In example:
Code:
Structure cLayer Extends cBase Extends tLayer
EndStructure


The constructing of datasets, based on propertyfragments would be very easy.

Best regards

Wolf

_________________
German blog about IT and programming
German PB forums


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 31, 2008 11:35 am 
Offline
Addict
Addict

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3371
+1 :)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 31, 2008 11:46 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Apr 27, 2007 12:38 pm
Posts: 589
Location: Finland
What happens when both cBase and tLayer have a structure field with the same name?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 31, 2008 12:51 pm 
Offline
Addict
Addict

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3371
eesau wrote:
What happens when both cBase and tLayer have a structure field with the same name?


It would probably result in a compiler error. :roll:


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat May 31, 2008 6:35 pm 
Offline
Always Here
Always Here

Joined: Mon Sep 22, 2003 6:45 pm
Posts: 7446
Location: Norway
That will destroy the whole concept of Extends, which is that the fields are placed first in the structure, so that the structure can be passed to functions expecting a pointer to the old structure.

This is how it works:
Code:
Structure SShape
  Color.l
EndStructure

Structure SRectangle Extends SShape
  Width.l
  Height.l
EndStructure

Procedure SShape_GetColor(*Shape.SShape)
  ProcedureReturn *Shape\Color
EndProcedure

My.SRectangle\Color = $deadbeef
Debug Hex(SShape_GetColor(@My))



Multi-extending is impossible, because the fields of SSoccerField and SShape can't both be placed first in SRectangle. That will make the code above mysteriously fail on this rectangle.
Code:
Structure SSoccerField
  NumberOfPlayers.l
EndStructure

Structure SShape
  Color.l
EndStructure

Structure SRectangle Extends SSoccerField Extends SShape
  Width.l
  Height.l
EndStructure


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 15 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye