Questions tagged [class-members]

This tag refers to members of a class in object-oriented language. These are fields, constructors, destructors, methods and, usually in higher-level languages, properties and events.

refers to members of a class in object-oriented language. These are fields, constructors, destructors, methods and, usually in higher-level languages, properties and events.

186 questions
-1
votes
3 answers

How to correctly deallocate class member?

Should I use delete overload or del() function or something else to deallocate class member? class Field { private: size_t* square = new size_t[5]; public: void del() { delete[] square; } void operator delete (void* p) …
-1
votes
2 answers

Return members of a hashmap through a class get method

The following returns the default "client?": class ClientMap def initialize @@clients = {"DP000459": "BP"} @@clients.default = "client?" end def get(id) return @@clients[:id] end end clientMap =…
progan01
  • 11
  • 3
-1
votes
1 answer

c++ storing arbitrary number of different classes in one class-member-array

Let's say I have a class template like this (you can't change grid, it represents a more difficult object, I don't like to change): template class grid{ public: double S[x][y]; grid(); ~grid();}; Now I wish a new class template (named…
Markus
  • 183
  • 1
  • 5
-1
votes
2 answers

Declaring an object as a member variable of itself

I'm writing a game engine (using SFML libraries) and I can't seem to get this to work. I'm writing the GUI portion of code and I want to declare a object of the same class inside itself (parent/child so I can link objects together). I can't do this…
Honor
  • 63
  • 2
  • 9
-1
votes
1 answer

Java Whose Field Will be Used, if Subclass Calls Superclass Method

I'm writing some Android code that need to utilize the inheritance feature. The following code snippet is the part that confused me: The SuperClass: public class Foo { public int length = 1; public int width = 2; public int height =…
Dreamer
  • 563
  • 1
  • 8
  • 25
-2
votes
2 answers

Class member function at() and switch statements with a loop

This is my first time posting here, so apologies in advance if I'm doing something wrong.I'm working on a project where a part of the program needs to translate a phone word (IE "Rad-Code") into corresponding phone digits (IE 723-2633). I'm trying…
1 2 3
12
13