Pointer declaration for data member, C/C++ Programming

Assignment Help:

Pointer declaration for data member: Method 1:

int M::* px; // This is known as pointer-to-member declared for class member of A.

px = &M::x;//The pointer px is pointing to the data member m in the class A. int S1;

S1=m.*px; 

Method 2: M *pm; pm=&m; int M::*py; py=&M::y; int S2;

S2=pm->*py;//pointer-to-object->*pointer-to-member function


Related Discussions:- Pointer declaration for data member

Find the largest and smallest average, Use the above problem and have ...

Use the above problem and have the program print the biggest and smallest sales for each employee for everyday of the month. Program should also find the largest and

#change to palidrome program, #A palindrome is a string that reads the same...

#A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrom

Explain call by reference, Call by Reference Passing variables(paramete...

Call by Reference Passing variables(parameters) to a function in C can be done in two ways - pass by value, also called as call by value and pass by address or also known as ca

# Bank Account class, Write a C++ program to test the Bank Account class fo...

Write a C++ program to test the Bank Account class for 10 customers.

Write down the class listnode, Question: (a) Write down the class 'Li...

Question: (a) Write down the class 'ListNode' to contain the following:- (i) variable data of type Object (ii) variable next of type ListNode (iii)

Give example of the for loop, The for Loop For loop is the controlled f...

The for Loop For loop is the controlled form of loop. The general format of this : for( initialize ; test ; update)                  {                     statements;

Why shouldn''t matrix class''s interface look like an array, Why shouldn't ...

Why shouldn't Matrix class's interface look like an array-of-array? A: Some people build a Matrix class that has an operator[] that returns a reference to an Array object (or po

Class and object, write a class player that contain attributes for the play...

write a class player that contain attributes for the player,s name,average and team

CptS 121 Program Development & Design program design in C, Write a program...

Write a program that performs character processing on 10 characters read in from a file, and writes the results to output files. Do NOT use loops or arrays to solve this problem. N

Padovan string , write a program that counts the number of occurences of th...

write a program that counts the number of occurences of the string in the n-th Padovan string P(n) program in java // aakash , suraj , prem sasi kumar kamaraj college progr

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd