A simple check to see which uCalc instance is the default.
ID: 366
See: IsDefault = [bool]
using uCalcSoftware;
var uc = new uCalc();
// The implicit 'uc' object is not the default upon creation.
Console.WriteLine($"Is 'uc' the default instance? {uc.IsDefault}");
// Create a new uCalc instance. It also won't be the default.
var myCalc = new uCalc();
Console.WriteLine($"Is 'myCalc' the default instance? {myCalc.IsDefault}");
// Let's get the actual default instance and check it.
uCalc defaultInstance = uCalc.DefaultInstance;
Console.WriteLine($"Is the instance from uCalc.DefaultInstance the default? {defaultInstance.IsDefault}");
Is 'uc' the default instance? False
Is 'myCalc' the default instance? False
Is the instance from uCalc.DefaultInstance the default? True using uCalcSoftware; var uc = new uCalc(); // The implicit 'uc' object is not the default upon creation. Console.WriteLine($"Is 'uc' the default instance? {uc.IsDefault}"); // Create a new uCalc instance. It also won't be the default. var myCalc = new uCalc(); Console.WriteLine($"Is 'myCalc' the default instance? {myCalc.IsDefault}"); // Let's get the actual default instance and check it. uCalc defaultInstance = uCalc.DefaultInstance; Console.WriteLine($"Is the instance from uCalc.DefaultInstance the default? {defaultInstance.IsDefault}");
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
#define tf(IsTrue) ((IsTrue) ? "True" : "False")
int main() {
uCalc uc;
// The implicit 'uc' object is not the default upon creation.
cout << "Is 'uc' the default instance? " << tf(uc.IsDefault()) << endl;
// Create a new uCalc instance. It also won't be the default.
uCalc myCalc;
cout << "Is 'myCalc' the default instance? " << tf(myCalc.IsDefault()) << endl;
// Let's get the actual default instance and check it.
uCalc defaultInstance = uCalc::DefaultInstance();
cout << "Is the instance from uCalc.DefaultInstance the default? " << tf(defaultInstance.IsDefault()) << endl;
}
Is 'uc' the default instance? False
Is 'myCalc' the default instance? False
Is the instance from uCalc.DefaultInstance the default? True #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; #define tf(IsTrue) ((IsTrue) ? "True" : "False") int main() { uCalc uc; // The implicit 'uc' object is not the default upon creation. cout << "Is 'uc' the default instance? " << tf(uc.IsDefault()) << endl; // Create a new uCalc instance. It also won't be the default. uCalc myCalc; cout << "Is 'myCalc' the default instance? " << tf(myCalc.IsDefault()) << endl; // Let's get the actual default instance and check it. uCalc defaultInstance = uCalc::DefaultInstance(); cout << "Is the instance from uCalc.DefaultInstance the default? " << tf(defaultInstance.IsDefault()) << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
'// The implicit 'uc' object is not the default upon creation.
Console.WriteLine($"Is 'uc' the default instance? {uc.IsDefault}")
'// Create a new uCalc instance. It also won't be the default.
Dim myCalc As New uCalc()
Console.WriteLine($"Is 'myCalc' the default instance? {myCalc.IsDefault}")
'// Let's get the actual default instance and check it.
Dim defaultInstance As uCalc = uCalc.DefaultInstance
Console.WriteLine($"Is the instance from uCalc.DefaultInstance the default? {defaultInstance.IsDefault}")
End Sub
End Module
Is 'uc' the default instance? False
Is 'myCalc' the default instance? False
Is the instance from uCalc.DefaultInstance the default? True Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// The implicit 'uc' object is not the default upon creation. Console.WriteLine($"Is 'uc' the default instance? {uc.IsDefault}") '// Create a new uCalc instance. It also won't be the default. Dim myCalc As New uCalc() Console.WriteLine($"Is 'myCalc' the default instance? {myCalc.IsDefault}") '// Let's get the actual default instance and check it. Dim defaultInstance As uCalc = uCalc.DefaultInstance Console.WriteLine($"Is the instance from uCalc.DefaultInstance the default? {defaultInstance.IsDefault}") End Sub End Module