I abstracted a method from a class also abstract.
But I'm not sure how to implement this method in the child class.
Here's my code, what do I get?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Banco_Exercicio1
{
public class Cliente
{
public string Nome { get ; set ;}
public string Rg { get ; set ;}
public string Cpf {get ; set ;}
public Cliente(string nome)
{
this.Nome = nome;
}
}
public abstract class Conta
{
public Cliente Titular { get; set; }
public double Saldo { get; set; }
public int Numero { get; set; }
public Conta(Cliente nome)
{
this.Titular = nome;
}
public Conta() {}
public abstract void Depositar(double Valor) ;
public abstract void Saca(double Valor);
}
public class ContaPoupanca : Conta // Essa linha apresenta erro: does not implement inherited abstract member
{
public ContaPoupanca(Cliente nome) : base(nome) { }
public ContaPoupanca() {}
public override void Saca(double Valor)
{
base.Saca(Valor + 0.10); //Error: Cannot Call an abstract member
}
}
public class ContaCorrente : Conta
{
public ContaCorrente(Cliente nome) : base(nome) { }
public ContaCorrente() {}
public override void Saca(double Valor)
{
base.Saca(Valor + 0.05); //Error: Cannot Call an abstract member
}
public override void Depositar(double Valor)
{
base.Depositar(Valor - 0.10); //Error: Cannot Call an abstract member
}
}
public class TotalizadordeContas
{
public double ValorTotal {get ; private set ;}
public double Soma (Conta conta)
{
ValorTotal += conta.Saldo;
return ValorTotal;
}
}
}
How to resolve and fix these errors?