[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Searching for members of classes
From: |
Suresh Govindachar |
Subject: |
Searching for members of classes |
Date: |
Sat, 14 Jun 2014 07:49:14 -0700 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
Hello,
Consider following partial code:
/* 1 */ class A
/* 2 */ {
/* 3 */ int x;
/* 4 */ void fun();
/* 5 */ }
/* 6 */ A::fun() { std::cout << x << "\n"; }
/* 7 */
/* 8 */ class B
/* 9 */ {
/* 10 */ int x;
/* 11 */ void fun();
/* 12 */ }
/* 13 */ B::fun() { std::cout << x*x << "\n"; }
/* 14 */
/* 15 */ main()
/* 16 */ {
/* 17 */ A u;
/* 18 */ B v;
/* 19 */
/* 20 */ u.x = 3;
/* 21 */ u.fun();
/* 22 */
/* 23 */ v.x = 5;
/* 24 */ v.fun();
/* 25 */ }
How to find all of A's x and only A's x: lines 3, 6, 20?
How to find all of A's fun() and only A's fun(): lines 4, 6, 21?
Thanks,
--Suresh
- Searching for members of classes,
Suresh Govindachar <=