cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Inizialize object in class
Inizialize object in class
Mar 29, 2014 at 7:21pm UTC
xx1182
(54)
Let's suppose i have this:
1
2
3
4
5
6
7
8
9
10
11
12
class
A {
public
: A(
char
*); }
class
B {
public
: B(); A aObj; }
Where do i inizialize aObj?
Mar 29, 2014 at 7:52pm UTC
Ispil
(788)
Well, aObj is a member of class B. Everything that you want to put into aObj would be through B. Since aObj is public, you can modify it directly via B.aObj.
Mar 29, 2014 at 9:00pm UTC
mutexe
(2372)
The initialisation list in B's constructor would seem a sensible place.
Topic archived. No new replies allowed.