Inspecting the stack depth as new defaults are added and cleared
ID: 273
See: DefaultCount = [int]
using uCalcSoftware;
var uc = new uCalc();
// Check initial state (Root instance only)
Console.WriteLine(uCalc.DefaultCount);
// Push the current 'uc' instance onto the stack
uc.IsDefault = true;
Console.WriteLine(uCalc.DefaultCount);
// Create a new instance and push it
var ucB = new uCalc();
ucB.IsDefault = true;
Console.WriteLine(uCalc.DefaultCount);
// Create another instance and push it
var ucC = new uCalc();
ucC.IsDefault = true;
Console.WriteLine(uCalc.DefaultCount);
// Clear all custom defaults, reverting to the root instance
uCalc.DefaultClear();
Console.WriteLine(uCalc.DefaultCount);
1
2
3
4
1 using uCalcSoftware; var uc = new uCalc(); // Check initial state (Root instance only) Console.WriteLine(uCalc.DefaultCount); // Push the current 'uc' instance onto the stack uc.IsDefault = true; Console.WriteLine(uCalc.DefaultCount); // Create a new instance and push it var ucB = new uCalc(); ucB.IsDefault = true; Console.WriteLine(uCalc.DefaultCount); // Create another instance and push it var ucC = new uCalc(); ucC.IsDefault = true; Console.WriteLine(uCalc.DefaultCount); // Clear all custom defaults, reverting to the root instance uCalc.DefaultClear(); Console.WriteLine(uCalc.DefaultCount);
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
// Check initial state (Root instance only)
cout << uCalc::DefaultCount() << endl;
// Push the current 'uc' instance onto the stack
uc.IsDefault(true);
cout << uCalc::DefaultCount() << endl;
// Create a new instance and push it
uCalc ucB;
ucB.IsDefault(true);
cout << uCalc::DefaultCount() << endl;
// Create another instance and push it
uCalc ucC;
ucC.IsDefault(true);
cout << uCalc::DefaultCount() << endl;
// Clear all custom defaults, reverting to the root instance
uCalc::DefaultClear();
cout << uCalc::DefaultCount() << endl;
}
1
2
3
4
1 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // Check initial state (Root instance only) cout << uCalc::DefaultCount() << endl; // Push the current 'uc' instance onto the stack uc.IsDefault(true); cout << uCalc::DefaultCount() << endl; // Create a new instance and push it uCalc ucB; ucB.IsDefault(true); cout << uCalc::DefaultCount() << endl; // Create another instance and push it uCalc ucC; ucC.IsDefault(true); cout << uCalc::DefaultCount() << endl; // Clear all custom defaults, reverting to the root instance uCalc::DefaultClear(); cout << uCalc::DefaultCount() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
'// Check initial state (Root instance only)
Console.WriteLine(uCalc.DefaultCount)
'// Push the current 'uc' instance onto the stack
uc.IsDefault = true
Console.WriteLine(uCalc.DefaultCount)
'// Create a new instance and push it
Dim ucB As New uCalc()
ucB.IsDefault = true
Console.WriteLine(uCalc.DefaultCount)
'// Create another instance and push it
Dim ucC As New uCalc()
ucC.IsDefault = true
Console.WriteLine(uCalc.DefaultCount)
'// Clear all custom defaults, reverting to the root instance
uCalc.DefaultClear()
Console.WriteLine(uCalc.DefaultCount)
End Sub
End Module
1
2
3
4
1 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// Check initial state (Root instance only) Console.WriteLine(uCalc.DefaultCount) '// Push the current 'uc' instance onto the stack uc.IsDefault = true Console.WriteLine(uCalc.DefaultCount) '// Create a new instance and push it Dim ucB As New uCalc() ucB.IsDefault = true Console.WriteLine(uCalc.DefaultCount) '// Create another instance and push it Dim ucC As New uCalc() ucC.IsDefault = true Console.WriteLine(uCalc.DefaultCount) '// Clear all custom defaults, reverting to the root instance uCalc.DefaultClear() Console.WriteLine(uCalc.DefaultCount) End Sub End Module