Can you solve my problem?

Q. Write a Program to create a object without name.

Help me...........

Recommended Answers

All 4 Replies

I'm not sure about this one, maybe you could have a pointer to some dynamically allocated memory?

Maybe something like:

#include <iostream>
#include <string>
int main(){
  std::cout << std::string("No name").c_str() << std::endl;
  // Or
  std::cout << std::string("No name") << std::endl;
  return 0;
}

Or maybe:

int main() {
  return 0; // 0 is an object and it doesn't have a name.
};

This example creates an array of strings and prints the first element.

#include "stdafx.h"
using namespace System;
int main(array<System::String ^> ^args)
{
    Console::WriteLine((gcnew String("Hello World"))->Split(' ')[0]);
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.