More C# how to handle constructor chaining funtions

I get how to overload a funtion with serveral arguments and
overload the funtion filling in the missing arguments so as
to call the funtion that contains the code, but the below C#
alludes me... HELP.

public DefaultAdorner(UIElement adornedElement, UIElement
adornerElement, Point adornerOrigin, double opacity)
            : base(adornedElement)
0
Peter
1/13/2011 2:04:30 AM
sybase.powerbuilder.net 284 articles. 0 followers. Follow

8 Replies
373 Views

Similar Articles

[PageSpeed] 14

In PB each function signature (name and arguments) is distinct. So if 
you wanted to omit an argument and have a default used, you would have a 
full function with all arguments, and delegating functions which call 
the full function passing along their arguments and filling in the 
others with constant defaults.
f_foo (a, b, c, d)
f_foo (a, b, c)
    return f_foo (a, b, c, 'dee')

Note that arguments are different if their type is different - you could 
have f_foo(string arg1) overloading f_foo (long arg1). SetItem (row, 
column, value), for instance, is actually a group of overloaded 
functions with different data types in the value argument.

Report Bugs to Sybase:  http://case-express.sybase.com/cx/welcome.do
Product Enhancement Requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement

On 1/12/2011 9:04 PM, Peter Conn wrote:
> I get how to overload a funtion with serveral arguments and
> overload the funtion filling in the missing arguments so as
> to call the funtion that contains the code, but the below C#
> alludes me... HELP.
>
> public DefaultAdorner(UIElement adornedElement, UIElement
> adornerElement, Point adornerOrigin, double opacity)
>              : base(adornedElement)
0
Jerry
1/13/2011 2:54:50 AM
Exactly how I knew it in PB, but what does C# mean when it
is coded , I don't understand the : base(arg1)
Public f_foo(arg1,arg2,arg3) : this(arg1,arg2,arg3,"dee")
{
}

Public f_foo(ag1,arg2,arg3,arg4) : base(ag1)
{
code goes here...
}

> In PB each function signature (name and arguments) is
> distinct. So if  you wanted to omit an argument and have a
> default used, you would have a  full function with all
> arguments, and delegating functions which call  the full
> function passing along their arguments and filling in the
> others with constant defaults. f_foo (a, b, c, d)
> f_foo (a, b, c)
>     return f_foo (a, b, c, 'dee')
>
> Note that arguments are different if their type is
> different - you could  have f_foo(string arg1) overloading
> f_foo (long arg1). SetItem (row,  column, value), for
> instance, is actually a group of overloaded  functions
> with different data types in the value argument.
>
> Report Bugs to Sybase:
> http://case-express.sybase.com/cx/welcome.do Product
> Enhancement Requests:
> http://my.isug.com/cgi-bin/1/c/submit_enhancement
>
> On 1/12/2011 9:04 PM, Peter Conn wrote:
> > I get how to overload a funtion with serveral arguments
> > and overload the funtion filling in the missing
> > arguments so as to call the funtion that contains the
> > code, but the below C# alludes me... HELP.
> >
> > public DefaultAdorner(UIElement adornedElement,
> > UIElement adornerElement, Point adornerOrigin, double
> >              opacity) : base(adornedElement)
0
Peter
1/13/2011 3:20:14 AM
What you are showing is the constructor of an object not a function. The 
class declaration looks like this (from CodeProject). Adorner is an abstract 
base class from the WPF framework.

   public class DefaultAdorner : Adorner
      {
          private UIElement _child;
          private Point _adornerOrigin;
          private Point _adornerOffset;

          /// <summary>
          /// Create an adorner with default opacity.
          /// The created adorner must then be added to the AdornerLayer.
          /// </summary>
          /// <param name="adornedElement">Element whose AdornerLayer will 
be use for displaying the adorner</param>
          /// <param name="adornerElement">Element used as adorner</param>
          /// <param name="adornerOrigin">Origin offset within the 
adorner</param>
          public DefaultAdorner(UIElement adornedElement, UIElement 
adornerElement, Point adornerOrigin)
              : this(adornedElement, adornerElement, adornerOrigin, 0.3)
          {
          }

          /// <summary>
          /// Create an adorner.
          /// The created adorner must then be added to the AdornerLayer.
          /// </summary>
          /// <param name="adornedElement">Element whose AdornerLayer will 
be use for displaying the adorner</param>
          /// <param name="adornerElement">Element used as adorner</param>
          /// <param name="adornerOrigin">Origin offset within the 
adorner</param>
          /// <param name="opacity">Adorner's opacity</param>
          public DefaultAdorner(UIElement adornedElement, UIElement 
adornerElement, Point adornerOrigin, double opacity)
              : base(adornedElement)
{ ....

DefaultAdorner is derived from Adorner. When creating a new instance of 
DefaultAdorner it automatically passes the parameter adornedElement through 
to the base class. It is not your job to do that.

To create an instance of DefaultAdorner you can use two different 
constructors. Depending on which one you use then it passes (automatically) 
values to either base class or, in this interesting case study, the first 
constructor simply hands on to the second constructor (interesting to me 
because I have not seen it done i that style before) which then passes it to 
the base class  .

So all you do is (in C# code)
DefaultAdorner defA = new DefaultAdorner ( adornedElement, adornerElement, 
adornerOrigin);

or

DefaultAdorner defA = new DefaultAdorner ( adornedElement, adornerElement, 
adornerOrigin, opacity);






 

0
Clive
1/13/2011 9:22:24 AM
Peter

: base  is a shortcut keyword that is used in a descendant class 
constructor to make an explicit call to a specific ancestor constructor 
before an overloaded constructor is invoked

Here's a simplified example

public class Circle
{ protected double radius=0;
public Circle  ( double d)
{ radius = d; }
}

public class MyCircle : Circle {
public MyCircle( ) { }
public MyCircle(double d) : base(d) { }//call 1arg ancestor constructor
}

I believe it can also be used on descendant methods to chain to a 
specific form of the ancestor method before invoking the descendant 
method. This is what you are seeing

Yakov

-- 
Yakov [TeamSybase]
eLearnIT LLC
Twitter: http://twitter.com/eLearnPB
Blog: http://yakovwerde.sys-con.com
Web Site: http://www.eLearnITOnline.com


On 1/12/2011 9:04 PM, Peter Conn wrote:
> I get how to overload a funtion with serveral arguments and
> overload the funtion filling in the missing arguments so as
> to call the funtion that contains the code, but the below C#
> alludes me... HELP.
>
> public DefaultAdorner(UIElement adornedElement, UIElement
> adornerElement, Point adornerOrigin, double opacity)
>              : base(adornedElement)

0
Yakov
1/13/2011 11:36:45 AM
I think I get it! but how would you do that in PB.

> Peter
>
> : base  is a shortcut keyword that is used in a descendant
> class  constructor to make an explicit call to a specific
> ancestor constructor  before an overloaded constructor is
> invoked
>
> Here's a simplified example
>
> public class Circle
> { protected double radius=0;
> public Circle  ( double d)
> { radius = d; }
> }
>
> public class MyCircle : Circle {
> public MyCircle( ) { }
> public MyCircle(double d) : base(d) { }//call 1arg
> ancestor constructor }
>
> I believe it can also be used on descendant methods to
> chain to a  specific form of the ancestor method before
> invoking the descendant  method. This is what you are
> seeing
>
> Yakov
>
> --
> Yakov [TeamSybase]
> eLearnIT LLC
> Twitter: http://twitter.com/eLearnPB
> Blog: http://yakovwerde.sys-con.com
> Web Site: http://www.eLearnITOnline.com
>
>
> On 1/12/2011 9:04 PM, Peter Conn wrote:
> > I get how to overload a funtion with serveral arguments
> > and overload the funtion filling in the missing
> > arguments so as to call the funtion that contains the
> > code, but the below C# alludes me... HELP.
> >
> > public DefaultAdorner(UIElement adornedElement,
> > UIElement adornerElement, Point adornerOrigin, double
> >              opacity) : base(adornedElement)
>
0
Peter
1/13/2011 4:07:49 PM
See here: It talks about overloaded constructors in an inheritance hierarchy

http://video.sybase.com/products/powerbuilder/powerscript-dot-net-tutorial/player.html?slide=108


-- 
Yakov [TeamSybase]
eLearnIT LLC
Twitter: http://twitter.com/eLearnPB
Blog: http://yakovwerde.sys-con.com
Web Site: http://www.eLearnITOnline.com

On 1/13/2011 11:07 AM, Peter Conn wrote:
> I think I get it! but how would you do that in PB.
>
>> Peter
>>
>> : base  is a shortcut keyword that is used in a descendant
>> class  constructor to make an explicit call to a specific
>> ancestor constructor  before an overloaded constructor is
>> invoked
>>
>> Here's a simplified example
>>
>> public class Circle
>> { protected double radius=0;
>> public Circle  ( double d)
>> { radius = d; }
>> }
>>
>> public class MyCircle : Circle {
>> public MyCircle( ) { }
>> public MyCircle(double d) : base(d) { }//call 1arg
>> ancestor constructor }
>>
>> I believe it can also be used on descendant methods to
>> chain to a  specific form of the ancestor method before
>> invoking the descendant  method. This is what you are
>> seeing
>>
>> Yakov
>>
>> --
>> Yakov [TeamSybase]
>> eLearnIT LLC
>> Twitter: http://twitter.com/eLearnPB
>> Blog: http://yakovwerde.sys-con.com
>> Web Site: http://www.eLearnITOnline.com
>>
>>
>> On 1/12/2011 9:04 PM, Peter Conn wrote:
>>> I get how to overload a funtion with serveral arguments
>>> and overload the funtion filling in the missing
>>> arguments so as to call the funtion that contains the
>>> code, but the below C# alludes me... HELP.
>>>
>>> public DefaultAdorner(UIElement adornedElement,
>>> UIElement adornerElement, Point adornerOrigin, double
>>>               opacity) : base(adornedElement)
>>

0
Yakov
1/13/2011 4:52:52 PM
You would define a parameterized constructor in the ancestor class with 
(say) 4 arguments.
You would define a parameterized constructor in the descendent class with 
only 3 arguments - the code of that event would simply invoke 
super::constructor( arg1, arg2, arg3, 'some default' )

Then, any instantiation of the descendent has the option of doing:

descendentClass myObj
myObj = create descendentClass( arg1, arg2, arg3 )  // uses the default
OR
myObj = create descendentClass( arg1, arg2, arg3, arg4 )  // passes a 
discrete value as #4


Paul Horan[Sybase]

<Peter Conn> wrote in message news:4d2f2355.4e02.1681692777@sybase.com...
>I think I get it! but how would you do that in PB.
>
>> Peter
>>
>> : base  is a shortcut keyword that is used in a descendant
>> class  constructor to make an explicit call to a specific
>> ancestor constructor  before an overloaded constructor is
>> invoked
>>
>> Here's a simplified example
>>
>> public class Circle
>> { protected double radius=0;
>> public Circle  ( double d)
>> { radius = d; }
>> }
>>
>> public class MyCircle : Circle {
>> public MyCircle( ) { }
>> public MyCircle(double d) : base(d) { }//call 1arg
>> ancestor constructor }
>>
>> I believe it can also be used on descendant methods to
>> chain to a  specific form of the ancestor method before
>> invoking the descendant  method. This is what you are
>> seeing
>>
>> Yakov
>>
>> --
>> Yakov [TeamSybase]
>> eLearnIT LLC
>> Twitter: http://twitter.com/eLearnPB
>> Blog: http://yakovwerde.sys-con.com
>> Web Site: http://www.eLearnITOnline.com
>>
>>
>> On 1/12/2011 9:04 PM, Peter Conn wrote:
>> > I get how to overload a funtion with serveral arguments
>> > and overload the funtion filling in the missing
>> > arguments so as to call the funtion that contains the
>> > code, but the below C# alludes me... HELP.
>> >
>> > public DefaultAdorner(UIElement adornedElement,
>> > UIElement adornerElement, Point adornerOrigin, double
>> >              opacity) : base(adornedElement)
>> 


0
Paul
1/13/2011 5:01:47 PM
Thx, this stuff is priceless, it will open all the C# sample
code to incorarate into PB as there is somuch of it out
there and PB can infact do 98% of it if you only know how.

> You would define a parameterized constructor in the
> ancestor class with  (say) 4 arguments.
> You would define a parameterized constructor in the
> descendent class with  only 3 arguments - the code of that
> event would simply invoke  super::constructor( arg1, arg2,
> arg3, 'some default' )
>
> Then, any instantiation of the descendent has the option
> of doing:
>
> descendentClass myObj
> myObj = create descendentClass( arg1, arg2, arg3 )  //
> uses the default OR
> myObj = create descendentClass( arg1, arg2, arg3, arg4 )
> // passes a  discrete value as #4
>
>
> Paul Horan[Sybase]
>
> <Peter Conn> wrote in message
> news:4d2f2355.4e02.1681692777@sybase.com... >I think I get
> it! but how would you do that in PB. >
> >> Peter
> >>
> >> : base  is a shortcut keyword that is used in a
> descendant >> class  constructor to make an explicit call
> to a specific >> ancestor constructor  before an
> overloaded constructor is >> invoked
> >>
> >> Here's a simplified example
> >>
> >> public class Circle
> >> { protected double radius=0;
> >> public Circle  ( double d)
> >> { radius = d; }
> >> }
> >>
> >> public class MyCircle : Circle {
> >> public MyCircle( ) { }
> >> public MyCircle(double d) : base(d) { }//call 1arg
> >> ancestor constructor }
> >>
> >> I believe it can also be used on descendant methods to
> >> chain to a  specific form of the ancestor method before
> >> invoking the descendant  method. This is what you are
> >> seeing
> >>
> >> Yakov
> >>
> >> --
> >> Yakov [TeamSybase]
> >> eLearnIT LLC
> >> Twitter: http://twitter.com/eLearnPB
> >> Blog: http://yakovwerde.sys-con.com
> >> Web Site: http://www.eLearnITOnline.com
> >>
> >>
> >> On 1/12/2011 9:04 PM, Peter Conn wrote:
> >> > I get how to overload a funtion with serveral
> arguments >> > and overload the funtion filling in the
> missing >> > arguments so as to call the funtion that
> contains the >> > code, but the below C# alludes me...
> HELP. >> >
> >> > public DefaultAdorner(UIElement adornedElement,
> >> > UIElement adornerElement, Point adornerOrigin, double
> >> >              opacity) : base(adornedElement)
> >>
>
>
0
Peter
1/13/2011 5:26:40 PM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

IT tests. XML, ASP.NET, HTML, C, C++, C#, VB.NET, SQL...
http://www.testyourabilities.com/it/ IT tests. XML, ASP.NET, HTML, C, C++, C#, VB.NET, SQL... ...

C# .Net conversion to C# ASP.Net
Hey guys!, Can someone show me what needs to be done to convert the following code to ASP.NET? Thanks for any help!   {         string bytesString = "string";          Console.WriteLine("{0} bytes",bytesString);         ulong  bytes = UInt64.Parse(bytesString);         string mb = ConvertToMegabytes(bytes);         string gb = ConvertToGigabytes(bytes); &nbs...

Windows Principle security working in C#.NET Windows application, but not on ASP.NET Web Application with C#.NET as code behind
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); WindowsPrincipal usrPrincipal = (WindowsPrincipal)Thread.CurrentPrincipal; WindowsIdentity usrIdentity = (WindowsIdentity)usrPrincipal.Identity; String usrPrincipalName = usrPrincipal.Identity.Name; String usrPrincipalType = usrPrincipal.Identity.AuthenticationType; String usrPrincipalAuth = usrPrincipal.Identity.IsAuthenticated.ToString()   Can you check why this code is not working in Web application, however it is working in Windows application  Is it crashing at runtime? Not compiling? What...

powerbuilder calls to c#.net
Hi, all > > I have some questions about how to make calls from > powerbuilder to dll which is created with c#.net. I coded > a very simple ClassLibrary with c#.net. Code listed below: But when I try to call it from pb(try version 8, 9, 10) Function Boolean validarlogin(string login, string dominio, string password) LIBRARY "validarac.dll" if validarlogin('fipial','quito','fercho55') then messagebox("USUARIO", "VALIDADO") else messagebox("USUARIO", "NO VALIDADO") end if thank you what ...

C#.NET in VS.NET vs. C# in Web Matrix
Hi all, I am very new to .NET ... I realized C#.NET is only available from Visual Studio.NET ... however, I realized Web Matrix also allowed us to choose C# as language but not C#.NET ... they are not the same, right? If not, then why it's in Web Matrix which runs ASP.NET?? If I need to run C#.Net, I MUST GET VS.NET, right? Can C#.NET has the abality to create chat program? Thank you very much. C#.NET and C# are the same thing. JimMS MVP ASP.NET [VC++/MFC emeritus]Old Dog Learns New TricksPreferred programming language: cuneiform on clay tablets So ... that means I can use web matrix t...

coping asp.net c# code to a windows .net c# app
I have something I need to schedule, just a bit of code which does some screen scraping and puts stuff in a database, would it just be a case of downloading visual c#.net express and copying and pasting the code to make a little windows app which does this? and schedule it using windows scheduler? You could try using a Web Service? I did think of this, as I thought it may be connected to how 'services' work in windows... But could not find any information on this?Do you know of any tutorials etc which might help with what I want to do? I did try googling it but couldnt find anything simi...

converting to vb.net from c#.net authorize.net
authorize.net offered me some sample code when I signed up with them the only problem is the sample code is in c#.net but my page that they type all of their credit card into is vb.net <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage("https://certification.authorize.net/gateway/transact.dll"); } private String readHtmlPage(string url) { ...

Diffrence Between ASP.NET , VB.NET and C#.NET
please give me the explanation of diffrence b'n asp.net and vb.net is in asp.net there is no code behind file exist?  C# and VB.Net it the langauge you use to create your app.. (The code you write is either VB.Net or C#) ASP.Net is the Web framework to build web applications and ASP.Net have Web Forms, a Web Form is the .aspx file that represents a page/view. A Web Form can have a code-behind file where you put your code (written with VB.Net or C#)./Fredrik Normén - fredrikn @ twitterMicrosoft MVP, MCSD, MCAD, MCTASPInsidersMy Blog...

Image Handling in asp.net with c#
HI All  I, for sometime trying to achieve the requirement where i need to draw a text on the existing Image. I eloberate with following exampleJust assume i have an image say a t-shirt and i will provide option for the user to enter text in a text box and on this i want to display the text written on the Image(i.e on my t-shirt image) that to on my drawing area. I am very new to Image manipulation APIs. I highly appreciate if some one can guide me for the better solution. Thanks in AdvanceSAS   Check this link.. http://www.codeproject.com/KB/web-image/TextOnImage.aspx...

Calling a C# (.NET) Method from PowerBuilder
Hello. I am looking for direction in regards to calling a C# module (written in the .NET (1.1) framework) from PowerBuilder. Here is the C#.NET information: NameSpace: DiscountLibrary Class: QS Method: CalculateQS() DLL: DiscountLibrary.dll From another message I found on this board, it suggested using the Regasm program to register the DLL/Class. I did this (regasm DiscountLibrary.dll) and it would appear to be successful (at least the reply told me that it was registered successfully). I am using PowerBuilder version 9.0.2. I have a simple window with a ...

Handling variant in C# with asp.net
hi in my application COM Server ( VC++6.0) is Server and c# is Client( asp.net)I have to call one method that contains arrays strig byte values etc....ExecMethod(object attr, int id)             in thisobject contains ( byte[], string,string[],int) i have make them into Object  //////////////////////////// Calling ExecWatchDog() ////////////////////////            int cliCallbackID = callbackId;            byte reqType ...

powerbuilder calls to c#.net #2
Hi, all > > I have some questions about how to make calls from > powerbuilder to dll which is created with c#.net. I coded > a very simple ClassLibrary with c#.net. Code listed below: using System; using System.DirectoryServices; namespace validarac { public class validar { public validar(){} public Boolean validarlogin(string login, string domain, string password) { string UsrC= domain + "\\" + login; DirectoryEntry us=new DirectoryEntry("",UsrC,password,AuthenticationTypes.None); try { UsrC = us.Name; retur...

Web resources about - More C# how to handle constructor chaining funtions - sybase.powerbuilder.net

Von Neumann universal constructor - Wikipedia, the free encyclopedia
Three generations of machine are shown: the second has nearly finished constructing the third. The lines running to the right are the tapes of ...

Bridge Constructor Playground on the App Store on iTunes
Get Bridge Constructor Playground on the App Store. See screenshots and ratings, and read customer reviews.

Lewis Hamilton wins inaugural Russian Formula One Grand Prix as Mercedes take constructors' title
... Russian Formula One Grand Prix and extended his championship lead on Sunday in a Mercedes one-two that clinched the team's first constructors' ...

Observation wheel constructor vows to fight court writ
The construction company being sued for $6 million by the owner of the troubled Melbourne Star Observation Wheel has vowed to vigorously contest ...

Bill Shorten denies Winslow Constructors union payment deal disadvantaged workers after royal commission ...
Opposition Leader Bill denies lucrative deal he oversaw while union leader disadvantaged workers.

Chinese constructor resumes work after security assurance
Chinese constructor resumes work after security assurance People's Daily Online MOYALE, Kenya, Dec. 16 A Chinese roads construction firm, Wu ...

Colleagues Remember ‘Master Crossword Constructor’ Merl Reagle
Colleagues Remember ‘Master Crossword Constructor’ Merl Reagle

Apps of the Week: Hurricane, Bridge Constructor Medieval, Origami Live Wallpaper and more!
It's the last edition of Apps of the Week for the month of May, and we've pulled together a great list of apps from the folks here at Android ...

A Chance To Win Bridge Constructor For iPhone And iPad
... has teamed up with Headup Games , our latest AppAdvice Daily podcast sponsor, in order to offer you a chance to win a copy of Bridge Constructor ...

Price Drop: Monster Constructor
Monster Constructor 1.0 Device: iOS Universal Category: Games Price: Free, Version: 1.0 ( iTunes ) Description: Monster Constructor lets you ...

Resources last updated: 12/15/2015 6:55:37 PM