Internal Test: Verify stack count during creation, stacking, and clearing.
ID: 272
See: DefaultCount = [int]
using uCalcSoftware;
var uc = new uCalc();
Console.WriteLine($"Initial: {uCalc.DefaultCount}");
// The implicit 'uc' is the first default. Pushing it again adds to the stack.
uc.IsDefault = true;
Console.WriteLine($"After pushing 'uc' again: {uCalc.DefaultCount}");
var ucB = new uCalc();
ucB.IsDefault = true;
Console.WriteLine($"After pushing ucB: {uCalc.DefaultCount}");
var ucC = new uCalc();
ucC.IsDefault = true;
Console.WriteLine($"After pushing ucC: {uCalc.DefaultCount}");
// Clear all user-defined defaults, leaving only the mandatory root instance.
uCalc.DefaultClear();
Console.WriteLine($"After Clear: {uCalc.DefaultCount}");
Initial: 1
After pushing 'uc' again: 2
After pushing ucB: 3
After pushing ucC: 4
After Clear: 1 using uCalcSoftware; var uc = new uCalc(); Console.WriteLine($"Initial: {uCalc.DefaultCount}"); // The implicit 'uc' is the first default. Pushing it again adds to the stack. uc.IsDefault = true; Console.WriteLine($"After pushing 'uc' again: {uCalc.DefaultCount}"); var ucB = new uCalc(); ucB.IsDefault = true; Console.WriteLine($"After pushing ucB: {uCalc.DefaultCount}"); var ucC = new uCalc(); ucC.IsDefault = true; Console.WriteLine($"After pushing ucC: {uCalc.DefaultCount}"); // Clear all user-defined defaults, leaving only the mandatory root instance. uCalc.DefaultClear(); Console.WriteLine($"After Clear: {uCalc.DefaultCount}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
cout << "Initial: " << uCalc::DefaultCount() << endl;
// The implicit 'uc' is the first default. Pushing it again adds to the stack.
uc.IsDefault(true);
cout << "After pushing 'uc' again: " << uCalc::DefaultCount() << endl;
uCalc ucB;
ucB.IsDefault(true);
cout << "After pushing ucB: " << uCalc::DefaultCount() << endl;
uCalc ucC;
ucC.IsDefault(true);
cout << "After pushing ucC: " << uCalc::DefaultCount() << endl;
// Clear all user-defined defaults, leaving only the mandatory root instance.
uCalc::DefaultClear();
cout << "After Clear: " << uCalc::DefaultCount() << endl;
}
Initial: 1
After pushing 'uc' again: 2
After pushing ucB: 3
After pushing ucC: 4
After Clear: 1 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; cout << "Initial: " << uCalc::DefaultCount() << endl; // The implicit 'uc' is the first default. Pushing it again adds to the stack. uc.IsDefault(true); cout << "After pushing 'uc' again: " << uCalc::DefaultCount() << endl; uCalc ucB; ucB.IsDefault(true); cout << "After pushing ucB: " << uCalc::DefaultCount() << endl; uCalc ucC; ucC.IsDefault(true); cout << "After pushing ucC: " << uCalc::DefaultCount() << endl; // Clear all user-defined defaults, leaving only the mandatory root instance. uCalc::DefaultClear(); cout << "After Clear: " << uCalc::DefaultCount() << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
Console.WriteLine($"Initial: {uCalc.DefaultCount}")
'// The implicit 'uc' is the first default. Pushing it again adds to the stack.
uc.IsDefault = true
Console.WriteLine($"After pushing 'uc' again: {uCalc.DefaultCount}")
Dim ucB As New uCalc()
ucB.IsDefault = true
Console.WriteLine($"After pushing ucB: {uCalc.DefaultCount}")
Dim ucC As New uCalc()
ucC.IsDefault = true
Console.WriteLine($"After pushing ucC: {uCalc.DefaultCount}")
'// Clear all user-defined defaults, leaving only the mandatory root instance.
uCalc.DefaultClear()
Console.WriteLine($"After Clear: {uCalc.DefaultCount}")
End Sub
End Module
Initial: 1
After pushing 'uc' again: 2
After pushing ucB: 3
After pushing ucC: 4
After Clear: 1 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() Console.WriteLine($"Initial: {uCalc.DefaultCount}") '// The implicit 'uc' is the first default. Pushing it again adds to the stack. uc.IsDefault = true Console.WriteLine($"After pushing 'uc' again: {uCalc.DefaultCount}") Dim ucB As New uCalc() ucB.IsDefault = true Console.WriteLine($"After pushing ucB: {uCalc.DefaultCount}") Dim ucC As New uCalc() ucC.IsDefault = true Console.WriteLine($"After pushing ucC: {uCalc.DefaultCount}") '// Clear all user-defined defaults, leaving only the mandatory root instance. uCalc.DefaultClear() Console.WriteLine($"After Clear: {uCalc.DefaultCount}") End Sub End Module