Questions tagged as 'classes-abstratas'

1
answer

Is it possible to hide a public method of the abstract class?

I have the following scenario: public abstract class ClasseA { public string[] MetodoC(string parametro, string nomeObjeto) { // ações metodo } } public class ClasseB : ClasseA { public string[] MetodoD(string...
asked by 20.08.2015 / 17:44
1
answer

Ensure that generic object passed as parameter is a subclass of an abstract class

First I would like to say that my question is not specifically about "verifying that a generic object passed as a parameter is a subclass of an abstract class." , but I could not choose a better title. If you find a better phrase, feel free to...
asked by 16.08.2015 / 04:54
2
answers

How to create a vector2 in C?

I would like to know if you have how to create a class, to store 2 variables, for example, a Vector2, where I would instantiate and use like this: Vector2 tile; int posX, posY; posX = tile.x; posY = tile.Y; or something like that.     
asked by 29.03.2014 / 07:17
2
answers

How to do a cast of a class typed in C #?

I have the Carro class that inherits from the Objeto class and another CarroTeste class that implements the abstract class TesteBase which implements the ITeste interface, both ( TesteBase and ITeste...
asked by 16.07.2015 / 17:03
2
answers

Implement abstract method in inheritance in Python

The following class hierarchy, where class "A" has an abstract method called "foo": # -*- coding: utf-8 -*- import abc class A: __metaclass__ = abc.ABCMeta def __init__(self): pass @abc.abstractmethod def foo(self):...
asked by 01.12.2015 / 21:31
1
answer

Can I declare a constructor in child classes when the parent class is abstract and already has a constructor?

My question is this: If I can declare a constructor in a class abstract and also in the child classes. And also how to access their values. For example: abstract class Animal { private $nome; private $idade; public funtion...
asked by 28.12.2014 / 06:19
1
answer

Should I use abstract class or interface?

I have a class that connects to Windows machines. I'm leaving it a bit more generic, so I can reuse it for other systems. I was able to identify four "generic" methods: connect status error message run With this, I put together a...
asked by 19.11.2016 / 18:23
1
answer

Is it possible to implement an abstract class in PHP without the need for inheritance like in Java?

It is possible to do in PHP "in the same way" the instance of class CachorroAbstract in method main below: public abstract class CachorroAbstract { public abstract void latir(); } public class Main{ public static void mai...
asked by 04.07.2016 / 22:47
3
answers

How to make a polymorphic pointer with this pointer in the parameter?

For example, in Qt (correct me, if logic is wrong, I have not done Qt for a long time), you can do this: QLabel label = new QLabel(this); Now let's suppose: #include <iostream> class AbstractBase { public: virtual void A...
asked by 11.02.2014 / 17:22
1
answer

PHP: Interface type attribute

I am doing a study of Project Patterns. My first pattern is Strategy, where I have an abstract class that has two attributes that should instantiate a class that implements a given interface. The interfaces: interface FlyBehavior { publ...
asked by 07.09.2017 / 17:53