Avis
Avis
CC#
Created by Avis on 2/20/2023 in #help
How do I call the constructor of a parent class?
If I have something like
abstract class parent {
public parent(string mom, string dad) {...}
}

public class child : parent {
//how do I cal the constructor of parent?
}
abstract class parent {
public parent(string mom, string dad) {...}
}

public class child : parent {
//how do I cal the constructor of parent?
}
All of the tutorials i've found only talk about inheriting a class.
19 replies
CC#
Created by Avis on 2/4/2023 in #help
Object that's passed in isn't recognized as an object?
using System;
using System.Collections.Generic;

class Program {
public static void Main (string[] args) {
List<Lot> auction = new List<Lot>();

mainMenu(auction);
}

public void mainMenu(List<Lot> lots) {
Lot currentLot = null;
...

}
}
using System;
using System.Collections.Generic;

class Program {
public static void Main (string[] args) {
List<Lot> auction = new List<Lot>();

mainMenu(auction);
}

public void mainMenu(List<Lot> lots) {
Lot currentLot = null;
...

}
}
I'm getting an error saying An object reference is required for the non-static field, method, or property 'Program.mainMenu(List<Lot>)' When I try to call mainMenu() in my main method. Am I not passing the auction variable correctly?
8 replies