Quantcast
Channel: Daz Script Developer Discussion - Daz 3D Forums
Viewing all articles
Browse latest Browse all 1036

Simple explanation for a C# developer (classes/inheritance)

$
0
0

Hi @all,

For some purposes, I want to use (quite simple) inhertance in scripts an I saw this is possible, but a bit frustrating for me, because I can't find a complete reference for scripting. I 'm professional developer, but comes from the Windows C# world. Understanding Java-Script (or similar dialect) is surley not the problem. But where can I find a documentation of keywords (and so on) which are useable in DAZ-Script ??

The following example snippet should show, where I have problems:

CBase.superclass    = Object;
CDerived.superclass = CBase;

///////////////
// CBase

//ctor
function CBase()
{
	this.valueA = 10;
}

CBase.prototype.dump = ?virtual? function()  //...how to declare as virtual?
{
    print(this.valueA);
}

///////////////
// CDerived

//ctor
function CDerived()  : base()  //...how to call the base-ctor?
{
	this.valueB = 5;
}

CDerived.prototype.multiply = function()
{
	return this.valueB * ???.valueA;    //...how to access properties from base?
}

//overwritten dump():
CDerived.prototype.dump = function()
{
    base.dump();           //...how to call the base-function?
    print(this.valueB);
}

 

Thx in advance for answering smiley

Greets Peter.


Viewing all articles
Browse latest Browse all 1036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>