This is the code for my class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Banco_Exercicio1
{
public class Conta
{
public string Titular { get; set; }
public double Saldo { get; set; }
public int Numero { get; set; }
public Conta(String nome)
{
Titular = nome;
}
public double Depositar(double Valor)
{
Saldo += Valor;
return Saldo;
}
public virtual void Saca(double Valor)
{
Saldo -= Valor;
}
}
public class ContaPoupanca : Conta
{
public override void Saca(double Valor)
{
base.Saca(Valor + 0.10);
}
}
}
This is my form code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Banco_Exercicio1
{
public partial class Form1 : Form
{
public Conta conta;
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
conta = new Conta ("Victor")
{
Numero = 1 ,
Saldo = 0
};
TBtextoTitular.Text = conta.Titular;
TBtextoNumero.Text = Convert.ToString(conta.Numero);
TBtextoSaldo.Text = Convert.ToString(conta.Saldo);
}
private void deposito_Click(object sender, EventArgs e)
{
conta.Depositar(Convert.ToDouble(TBtextoValor.Text));
TBtextoSaldo.Text = Convert.ToString(conta.Saldo);
}
}
}
I have the following error:
Bank_Exercise1.Conta does not contain a constructor that takes 0 arguments "
How can I resolve this?