Questions tagged [member]

A member is an element of an object in the object-oriented programming paradigm.

A member is an element of an object in the object-oriented programming paradigm. Member variables are often called fields, while member functions are also called methods.

1628 questions
-1
votes
1 answer

Assign temporary struct pointer as struct member

Let's say i have the following structs: struct Foo { int val; }; struct Test { Foo *bar; }; and I wanted to create a Test struct: Test get_test() { Test test; Foo foo; foo.val = 10; test.bar = &foo; cout << "INIT: " << test.bar->val…
Ibrahim Fadel
  • 479
  • 4
  • 12
-1
votes
1 answer

How can one NSWindow's ID be got

I am new to Obj-c/Cocoa and want to know how to get one NSWindow's ID/number? The following member variable of NSWindow is found on Apple's website. var windowNumber: Int The window number of the window’s window device. However how to get it? Shall…
arthur.gu
  • 3
  • 1
-1
votes
2 answers

Why can I call a member function through a wild pointer

#include using namespace std; class Car{ public: void start() { std::cout << "start" << std::endl; }; virtual void stop() { std::cout << "stop" << std::endl; }; }; int main() { Car* p;// = new Car; …
Yves
  • 8,474
  • 7
  • 59
  • 114
-1
votes
1 answer

Getting information (types, values...etc) on members of C type struct

I would like to get some help on C-style struct. I do not have much understanding in C so I am not familiar with the basics. Right now, I have a struct (outerStruct) that has other structs as members (innerStruct1, innerStruct2...). What I need to…
Mikan
  • 79
  • 6
-1
votes
1 answer

F# Get Members of Module

Given type Unit = { Name : string Abbreviation : string Value : float } module Lets = let meter = { Name = "meter"; Abbreviation = "m"; Value = 1.0 } let millimeter = { Name = "millimeter";…
Brett Rowberry
  • 846
  • 7
  • 16
-1
votes
1 answer

How to get iterator over only the members of a class inside a container in C++

In C ++, I wonder if there is a way to get an iterator that only traverses a specific member of a class when it is contained in a container. The situation is as follows. class Edge : public std::pair { private: int length; public: …
umbum
  • 21
  • 4
-1
votes
2 answers

Initializing a member field with a member field of another class

I want to initialize a member field with a member field of another class. // a.hpp class A { public: std::string m_protocol_field_end{"\n"}; // should be changeable, therefore no const ... // b.hpp class B { public: const std::string…
B. A. Sylla
  • 335
  • 1
  • 11
-1
votes
1 answer

Add member to Node

I want to add a member to a Node! I thought that would work: extension SKNode { var obstacleType:String = "" } But it didn't! And I wanted to add the member like this: ANode.obstacleType == "Stone" And cola it like this: if…
-1
votes
2 answers

External lib friend function

I am using wgetch function from curses.h and want to call e.g wgetch(handle) where handle is private member of my class. Is there any way to do it without defining new friend function of my class (like below) or maybe making it method somehow? class…
Mat3o
  • 3
  • 1
  • 3
-1
votes
1 answer

Class member functions definitions in separate libraries, and link dependencies

Given a class C defined in C.h, and member functions f1 to fn, and member function g1. f1..fn's definitions are in f.cpp while g1's is in g.cpp. f.cpp is linked into lib1.so while g.cpp is linked into lib2.so. g.cpp depends on C.h,and lib2.so…
MMM
  • 794
  • 4
  • 19
-1
votes
3 answers

Integer counts wrong

I'm working on a big project, but for this question I write a simple example of the problem. I have 2 classes. public class Main { public static void main(String[] args) { CustomType[] customType = new CustomType[3]; for(int…
-1
votes
2 answers

pointers to vectors as class members pointers to vectors in functions

I'm a noob. Using C++ in Clion I'm building a graph of N random nodes on a Cartesian plane I have a simple type, node (just a point) (int x, int y) node pt(x,y) I have a vector of N randomly generated unique points (would this be considered…
-1
votes
3 answers

How do I make 2D array data members in Javascript?

What I have now are data members, each with a varying number of arrays with a length of 4: const obj={ member1:{ a1:[1,2,3,-4], a2:[0,1,-8,-1], a3:[-.10,9,5,110] } member2:{ a1:[1,0,8,-4], …
Mot
  • 23
  • 1
  • 4
-1
votes
2 answers

Constructing a class Poet with ifstream and then constructing it's member class Verse with same ifstream

Imagine a class named Poet, with a member FirstName, LastName and class named Verse as Poet's member. is it possible to construct Poet with ifstream, then initialize FirstName and LastName with ifstream, then construct member Verse with the same…
Nick
  • 61
  • 1
  • 8
-1
votes
1 answer

Calling static class member

I have the following code and cant figure out how to call the function (GetPageCount), which by way i found here. I have tried more than several methods how ever none have worked. Would appreciated some assistance with the line the calls the…
user68650
  • 105
  • 9
1 2 3
99
100