.Net Framework c#

Program for tower of hanoi public int NumberofDisc { get; set; } public char from{get; set;} public char to {get; set;} public char other {get; set;} //public int totalDisc { get; set; } public Disc(int numberofDisc) { this.NumberofDisc = numberofDisc; numberofDisc = 4; } public void MoveDisc(int Totaldisc , char From, char To, char Other) { this.NumberofDisc = Totaldisc; this.from = From; this.to = To; this.other = Other; } i want to create a pole that has a stack of disc and i also want to create a single disc on a pole how can i do this?

30th Jan 2020, 10:40 AM
Aderibigbe Ebenezer Adewale
Aderibigbe Ebenezer Adewale - avatar
1 Answer
Just create a pole object that has a stack<discs> discs object and access the discs public getter to add and remove discs, as its a stack you will only be able to add to the top (push) and remove from the top (pop)
12th Sep 2021, 3:28 PM
jack - avatar