SINGLE instance of a Codeunit and assigns

csimoneaux
Member Posts: 168
Form A calls on SINGLE instance of a Codeunit and assigns 'RED' to a global text variable. Form B call an instance of the same Codeunit and assigns the same global variable 'BLUE'. Form A then calls another function in the same Codeunit and retrieves the value of the global variable. What is the value?
a) Red * (chose a) <=
b) Blue (or
<=
c) Null
d) You can't do this
Because it is a Single instance I have been told answer is A
BUT
Form A then calls another function in the same Codeunit and retrieves the value of the global variable
So would this make the answer B. I am so confused.
a) Red * (chose a) <=
b) Blue (or

c) Null
d) You can't do this
Because it is a Single instance I have been told answer is A
BUT
Form A then calls another function in the same Codeunit and retrieves the value of the global variable
So would this make the answer B. I am so confused.
0
Comments
-
read this
How To pass parameters between objects (forms, reports, ...)? Revisited
http://www.mibuso.com/howtoinfo.asp?FileID=90 -
Here's what you do:
Create a single instance codeunit and two forms and start experimenting.0 -
-
Yes, this is an exam question. I do not just want to get answers to questions...I want to understand concepts and logic. Y'all have provided all of this.
Thank you sooooo much. \:D/ \:D/ \:D/0 -
Hi ajhvdb,
How could u say thatis the right answer, can u explain it little further :?:
As i think the answer is A) Red. :-k0 -
the code unit is single instance and uses a global var.
all values in global vars remain in memory until cleared or closing navision.
the last assigned value is blue.0 -
Because it is Single instance, each global variable exists only once. And it is the point. If you assign BLUE in same var, it will be still BLUE. If you assign something other (does not matter from where), it will overwrite this value. It is still same place in memory, same variable... because each global variable defined as this codeunit, leads to same Instance = same point in memory, same object, same global variables etc...0
-
Excellent explanation, you always wanted to be a teacher ofcourse. 8)0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions