Maujey
Maujey
CC#
Created by Maujey on 9/4/2024 in #help
How to use ExtensionMethods for structs
No description
5 replies
CC#
Created by Maujey on 1/7/2024 in #help
How to share instance of an object in base class to its inherited classes?
class Window
{
protected WindowManager windowManager;

public Window()
{
windowManager = new WindowManager();
}

public virtual void DrawWindow()
{
}
}
class Window
{
protected WindowManager windowManager;

public Window()
{
windowManager = new WindowManager();
}

public virtual void DrawWindow()
{
}
}
using System;

class LockscreenWindow : Window
{
private PasswordManager passwordManager;


public override void DrawWindow()
{
passwordManager = new();

Console.Write("Enter Password: ");
string password = Console.ReadLine();

if(password == passwordManager.GetPassword())
{

Console.WriteLine("Password correct");
windowManager.SwitchWindow(WindowManager.WindowName.Homescreen);
}else
{
Console.WriteLine("Password Incorrect");
}
}

}
using System;

class LockscreenWindow : Window
{
private PasswordManager passwordManager;


public override void DrawWindow()
{
passwordManager = new();

Console.Write("Enter Password: ");
string password = Console.ReadLine();

if(password == passwordManager.GetPassword())
{

Console.WriteLine("Password correct");
windowManager.SwitchWindow(WindowManager.WindowName.Homescreen);
}else
{
Console.WriteLine("Password Incorrect");
}
}

}
12 replies
CC#
Created by Maujey on 1/5/2024 in #help
Calling a method from static class which also inherits from a non static class
Calling a method from static class which also inherits from a non static class
91 replies
CC#
Created by Maujey on 9/9/2022 in #help
Tested it a lot of times but still giving unexpected error
3 replies