Skip to main content

Questions tagged [datamember]

A data member in object-oriented programming is a class member which holds data. In Java, it is called "field". Colloquially, it is sometimes called "member variable".

0 votes
1 answer
102 views

Question about C++ pointers in a class instance declared as const [duplicate]

If i were to create a simple class like this: class foo { int* a; }; and then create an instance of that class that is const: const foo; would foo's member a be a const int* or a int* const? I feel ...
noboby's user avatar
  • 11
1 vote
1 answer
52 views

makeNode function. what's wrong with it?

I created 2 struct dl and Node. I used struct dl for created Node and created function makeNode. Please help me! Thanks you guys read it. typedef struct _dl { char ProblemID[10]; char ...
Trang Bùi's user avatar
4 votes
2 answers
620 views

What is the difference between C++ "data member" and "field"?

I am translator in company and often we have problem to understand the difference between the terms "data member" and "field". Could you please describe what they are and how they ...
Lloydy Lloyde's user avatar
1 vote
3 answers
216 views

How to lazy init class member without a default constructor

How do I lazy init class members without a default constructor? Here is the minimum reproducible example: #include <stdio.h> #include <string> #include <iostream> using namespace std;...
mikmke's user avatar
  • 51
0 votes
2 answers
52 views

How to sum up properties' values from datamember in C#?

I have an event class defined as the following: [Serializable] [DataContract] public class BaseEvent { [DataMember] public int count { get; set; } [DataMember] public SubEventClass ...
Deritha's user avatar
  • 67
0 votes
2 answers
156 views

How to remove unused data-members?

The following code contains an example template X, where the data-member is unused, if the template is parametrized with other type than A. But the sizes of the objects a and b are the same, even with ...
wimalopaan's user avatar
  • 5,292
0 votes
0 answers
207 views

Most efficient way to mutate data member

I've been wondering about this question for a long time. What is the most idiomatic and / or efficient way to assign a new value to a data member (mutation)? I can think of 3 options: Mutate directly ...
glades's user avatar
  • 4,445
1 vote
2 answers
981 views

Assigning a class variable in class definition versus at class instantiation

What are the ramifications of assigning a class variable when defining the class versus in the class constructor? Is the variable assigned in the class definition accessible by all class instances? ...
Carter Canedy's user avatar
2 votes
2 answers
111 views

confusion of address of a pointer

I see a piece of code like this: #include<stdio.h> struct person{ int age; float weight; }; int main(){ struct person *personPtr, person1; personPtr = &person1; printf("...
hodondo's user avatar
  • 91
0 votes
2 answers
2k views

Store the details of employee and display the max salary using c++

I am trying to create a program that stores the data of employees and then displays the highest salary employee separately. Here, What I had tried. #include <iostream> #include <limits> #...
ASHISH KUMAR's user avatar
-1 votes
1 answer
30 views

Is writing data members inside ctor more pythonic? [duplicate]

My limited experience in python shows that class Person: def __init__(self): self.data: Tuple[int, str] = (5, "M") print("DONE") is more common than class ...
OrenIshShalom's user avatar
0 votes
2 answers
735 views

Is constructor called in before the data members in C++

Hello i am new to learning C++. Is constructor created in the order i create it in the class or is it always called first before anything else is created in the class. #include <iostream> using ...
Waleed's user avatar
  • 73
0 votes
0 answers
36 views

what is the point of using [Datamember] in c#? [duplicate]

I've been looking this up but I just can't seem to understand the point or the advantages of using it when should I use it?
Isaac Bredbenner's user avatar
0 votes
0 answers
404 views

Devexpress report : table repeating C#

I have a report. I have created a table at design time and data is filled at runtime. When it's run, two tables are created for two rows. Either I need all data rows in one table row or add multiple ...
user14805556's user avatar
2 votes
1 answer
366 views

Restrict use of instance variable to single method in C#

I want to be able to restrict usage of a instance variable to one method, and other usages should not be possible (compile error, or warning). For instance public class Example { public string ...
MrZarq's user avatar
  • 258

15 30 50 per page
1
2 3 4 5
14