Questions tagged [derived-class]

In Object Oriented languages, derived class can inherit properties and/or member functions from a base class, also called super class. cf inheritance and polymorphism.

In Object Oriented languages, derived class can inherit properties and/or member functions from a base class, also called super class. cf inheritance and polymorphism.

1192 questions
-3
votes
1 answer

What does this program do, and how does it do that?

I am having trouble figuring out why this program works. I wrote it based on my notes (OOPP and classes) but I do not understand how exactly it works? I would appreciate any help! Here is the code: #include #include using…
-3
votes
4 answers

dynamic base class constructor call in derived class constructor in c++

I have a base class in a library which I don't want to modify for compatibility reasons. This class stores certain settings that cannot be modified after construction; the correct arguments must be provided at the time of construction. My own code…
EXIT_FAILURE
  • 278
  • 1
  • 13
-3
votes
1 answer

C++ derivative class with virtual function

I have a problem with some task. I need to write an derived class in which I need to be sure, that vector FVect cointains only characters <'a'; 'z'>. class Something { private: char FVect[3]; protected: virtual void setValue(int _idx, char…
-3
votes
1 answer

Is it possible to generalize an object type in a helper function?

I have a class CLASS. Classes A and B are derived from CLASS. CLASS, and therefore A and B too, have a field to hold a pointer to an array of pointers to CLASS. Say I have a member function of A that does some calculations, creating objects of type…
J. Cal
  • 157
  • 1
  • 3
  • 18
-3
votes
1 answer

How to define a derived class in c++?

I learnt Walter Savitch's Absolute C++ (5th ed.) about 2 years ago. The way to declare a derived class in this book is that class ChildClass:Public ParentClass{...} where the parent class is something like class ParentClass {Public: double…
-3
votes
2 answers

What exactly constructors do?

Yesterday I was reading PHP classes and suddenly something got weird to me. And that was about constructors in C# and PHP. My question is what is constructor? Isn't it a special methods, used when instantiating a class that can does something like a…
Mohammad Amin
  • 39
  • 1
  • 7
-3
votes
1 answer

Base and derved class c++11

I have base class Aclass and derived class Bclass. If I create object Bclass b and if I write A &aref(b) is &aref now object of a class A or class B?
Lamija37
  • 7
  • 4
-3
votes
1 answer

Address of a static variable when instance created

I have a c++ class which has static const and static variable on it. During startup I initialize all the static const variables with some string values and all the static variables with zeros. Then I create 1st instance of that class and tried to…
kar
  • 495
  • 1
  • 8
  • 19
-3
votes
1 answer

Need a VB.net Combobox derived class for pattern matched or contains autocomplete functionality

Ive searched everywhere on the net for a solution to this common pain. Surely someone out there has a solution or can help me implement one ???? Basically the default combobox in vb.net autocompletes using a limited "StartsWith" pattern match (for…
-3
votes
1 answer

Invalid token 'base' in class, struct, or interface member declaration

I am not sure what the problem is but what I'm trying to do is to pass argument to a base constructor from a derived class's error: Invalid token 'base' in class, struct, or interface member declaration here is my base class code: public class…
Nick Kahn
  • 19,652
  • 91
  • 275
  • 406
-3
votes
2 answers

Accessing Derived class members in base class method

I have a peculiar requirement and not been able to find a solution. class Base { public: void func() { //access the member say 'var' of derived class } } It is mandatory in our case that all derived class from base will have…
Dexter
  • 1,299
  • 3
  • 20
  • 38
-4
votes
3 answers

Can I point a derived class to a different base? (i.e: change the family of a child)

I was writing some exercise code to understand class inheritance and I couldn't figure out If there is a way to do what I tried to explain in the title. So what I want to do to have Family and Member (family members) class. A family can have…
korel
  • 1
  • 1
  • 3
-4
votes
1 answer

C++ Copy Constructor for a Derived Class

So I have this class that has three parent functions, or in other words, it is derived from three other classes. I'm trying to make a copy constructor, and this is what I have: // Copy constructor extPersonType (extPersonType &obj) :…
Tristan
  • 47
  • 1
  • 1
  • 9
-4
votes
1 answer

In member function errors c++

I am receiving some errors when compiling my code. circleTypeImp.cpp: In member function âdouble circleType::getRadius() constâ: circleTypeImp.cpp:10: error: argument of type âdouble (circleType::)()constâ does not match âdoubleâ circleTypeImp.cpp:…
p. sawyer
  • 1
  • 4
-4
votes
1 answer

C++ Derived class constructors

Say i have a class representing the subscribers for a library. I then want to create multiple other derived classes representing different types of subscribers such as students, professors etc.. How do i write the derived class constructor ? In my…
student
  • 9
  • 3
1 2 3
79
80