C
C#8mo ago
randomokay

❔ homework

drawing memory
29 Replies
randomokay
randomokay8mo ago
they want me to draw the memory after running the Three t command
randomokay
randomokay8mo ago
i cant figure it out even with the answer i start with class three : one right?
Pobiega
Pobiega8mo ago
oh, you're supposed to graphically represent the objects and their references?
randomokay
randomokay8mo ago
ye how do i start
Pobiega
Pobiega8mo ago
Three makes sense, since that is your entrypoint, and also the only class with only 1 instance I'd start with drawing three and the two fields inside it.
randomokay
randomokay8mo ago
Ok p = new Two(new One(), 1); the first command what do they mean with new One
Anu6is
Anu6is8mo ago
the new keyword creates an instance of a class.... in this case One
randomokay
randomokay8mo ago
it refers to class one right
Anu6is
Anu6is8mo ago
because the constructor for Two expects a One and an int yes, it creates an instance of class one
randomokay
randomokay8mo ago
but what does the , 1 mean
Anu6is
Anu6is8mo ago
^
public Two(One b, int c)
{
//code here
}
public Two(One b, int c)
{
//code here
}
randomokay
randomokay8mo ago
ooh
Anu6is
Anu6is8mo ago
that's the constructor for two
randomokay
randomokay8mo ago
but class three : one cant access class two?
Anu6is
Anu6is8mo ago
what do you mean by can't access it exactly?
randomokay
randomokay8mo ago
its in a different class
Anu6is
Anu6is8mo ago
Two and Three are classes you can't really say Two is "in" a different class... it is a class of its own
randomokay
randomokay8mo ago
ye but dont i need a reference to access information about class two
Anu6is
Anu6is8mo ago
so you are creating an instance of class two
randomokay
randomokay8mo ago
like with inheritance i can access information about class 1
Anu6is
Anu6is8mo ago
you aren't yet acessing information about it this isn't accessing anything, it's creating
randomokay
randomokay8mo ago
oh oke
Anu6is
Anu6is8mo ago
again, the new key word creates an instance of a class so new Two(...) is creating a instance of Two
randomokay
randomokay8mo ago
what does it take as argument p = new Two(new One(), 1); for this one it takes int c = 1 and b = new One?
Anu6is
Anu6is8mo ago
yes
randomokay
randomokay8mo ago
ah i think i get it now thanks for the help
Accord
Accord8mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts
❔ running an mvc in .net framework(not core) whose output type is a library?How to do it? I get ""Unable to run your project. The "RunCommand" property is not defined."" https✅ WPF TreeView only shows icon and only for the root itemhave a tree declared with the following XAML and added from code behind a single item for the root. ✅ Deferred Execution or Forcing Immediate ExecutionSo I was reading the documentation on LINQ and I came across the two concepts i wrote in the title, ❔ Possible to copy value of object in debugger and generate code which will recreate this objectI have an awfully complicated class and wish I could copy an object in the debugger, and use that da❔ How to fix this problem. I am new to both VS Code and Unity.I am trying to get C# scripts of unity to open in VS Code. Please feel free to ping me and u can add❔ How do I initialize a static list with objects? (Quidditch app)I am feeling completely lost on this. I have a playermanager which contains a static list of Player ✅ Transparent BackgroundI'm trying to use AvaloniaUI in my project (linux, mac, and windows only) but I'm not sure how to cr✅ EF Core long running query causing concurrency issuesHello. I have a .NET application that uses a DbContext with PostgreSQL. To test the performance of m❔ (Beginner) Seeking Advice on Distributing Items Equally in C# ProgramHey everyone! I hope you're doing well. I'm still pretty new around here and not exactly a pro in t❔ ENV var dump collection not working on some machinesI'm using these env vars to collect dumps from my .net core macOS app (docs: https://learn.microsoft