Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8390157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:54:44+00:00 2026-06-09T18:54:44+00:00

I have a basic oop question: I use (for example in the sharepoint development)

  • 0

I have a basic oop question:

I use (for example in the sharepoint development) at the beginning of an operation a New constructor, but later not. For example:

' CREATES A INSTANCE OF SPSITE FROM GIVEN URL '
Dim site As spsite = New spsite("http://myhost")

' HERE I DO NOT NEED TO USE NEW(...) AND IT RETURNS AN SPSITE OBJECT, '
' A NEW SPSITE OBJECT '
Dim web As spweb = site.openweb()

My question: Why do i need at the first object of site the use of new, and in the second line not!?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:54:45+00:00Added an answer on June 9, 2026 at 6:54 pm

    I don’t really understand your problem, but if both lines are in your code (and they should be) then it works like this:
    This first line creates a new spsite object, which you can access with the variable named: site

    dim site as spsite = new spsite("http://myhost")
    

    Here you create a new spweb variable, by invoking the openweb() method of your previously created site variable. This is a function call. this function returns an spweb instance so you don’t need a new one.

    dim web as spweb = site.openweb()
    

    openweb() either has a new spweb() inside it, or the new spsite(“myhost”) created a new openweb for you (this you don’t have to know, you just know, you’ll get an spweb object)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic question in Java, but it's a general question in OOP.
I'm brand new to OOP and I have a question that's gotta be pretty
I understand the basic principles of inheritance in OOP, but I have a specific
I'm rather new to OOP and have a question about how to best deal
I have basic hello word example of Prime Faces. I have created dynamic web
I have a basic math question. I am trying to get a percentage from
I have a pretty good non-OOP background. I've done lots of Visual Basic coding,
I am new to Corona and am trying to get some basic OOP going
I'm new to programming, I have some basic python programming from college, I am
Currently, i have basic C++ and PHP skills. But, i want to switch to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.