Hello I am making a primitive AI program, but do not know how to instantiate a class...

PrimAI

New member
Joined
Mar 11, 2023
Messages
1
Programming Experience
1-3
C#:
namespace SafeHaven
{
    public class Class
    {
        public string Name { get; set; }
        public string Description { get; set; }

        public decimal Balance { get; set; }

        public int Amount { get; set; } = 0;

        public void MakeCharacteristics() { }

        public void MakeCharacteristics(int amount) { }

        public Class(string name, string description, decimal InitialBalance) {
            this.Name = name;
            this.Description = description;
        }
    }
}
//im trying to import this
C#:
// See [URL='https://aka.ms/new-console-template']C# console app template changes in .NET 6+ - .NET[/URL] for more information
// A skeleton of a C# program
using System;
using SafeHaven;

abstract class Brain
{
    public void StartNeurons() { char[] neurons = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); }

    protected char[] AddNeurons(char[] neurons)
    {
        return neurons;
    }
    public virtual string Drive(char[] chars, int index) { return "neurons"; }

    public abstract int neuronIndicator();
}



class MainMethod
{

    // Main Method
    static public void Main(String[] args)
    {
        char[] alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
        Console.WriteLine("Main Method");
        Console.WriteLine(alpha);

        var account = new Class("Gabon", "Millionaire", 1000000);
       
    }
}
//into this
 
Last edited by a moderator:
Welcome to the forum. In the future, please put code inside code tags. You can easily do this by using the button on the toolbar that looks like </>.

Anyway, why are you trying to import one class into another class? Won't that new class then have more than a single responsibility? Recall that in any programming language, applying the Single Responsibility Principle is a best practice because it simplifies understanding and maintaining code.
 
Back
Top Bottom